Suggest import column mappings from headers (ANALYST+, dashboard user)
const url = 'https://api.invogi.com/v1/data-profiles/suggest-mapping';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"datasetKind":"INVOICE_HISTORY","headers":["Vendor Name","Bill Number","Invoice Date","Gross Total"],"consent":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.invogi.com/v1/data-profiles/suggest-mapping \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "datasetKind": "INVOICE_HISTORY", "headers": [ "Vendor Name", "Bill Number", "Invoice Date", "Gross Total" ], "consent": true }'Explicitly requested, header-only AI assistance. Requires consent=true and the workspace Owner’s external AI processing setting. No row values, file names, company/supplier records or profile IDs are accepted. At most 200 headers of 200 characters each, totaling 12,000 characters. The provider receives only the dataset type, Invogi field definitions and indexed headers. Returns a draft; never creates, activates or imports a profile and never infers financial facts or date/number conventions. Unknown fields, absent/duplicate columns and repeated assignments are discarded. Shared AI policy (ai-assistance-policy@1): generation requires the workspace’s effective AI mode, task rollout and Owner processing setting (see GET /organizations/current/ai-assistance); one successful, nonempty result uses one unit of the shared allowance, while empty, failed or stale output does not. A shared guard allows 30 requests per workspace per hour and two concurrent preparations. Refusals carry error.details.reason (for example ROLLOUT_OFF, NOT_ENROLLED, TASK_PAUSED, ALLOWANCE_EXHAUSTED with resets_at, SERVICE_LIMIT). A repeated request for the same headers by the same user within a day returns the private cached result without using another unit; a concurrent duplicate returns CONFLICT. Audit and usage records retain counts, versions and provider cost, not headers or generated text. Applying mappings and normal row validation are separate user steps. API keys cannot call this endpoint.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”For a Clerk session, selects a workspace in which the user has an active membership. If omitted, the remembered accessible workspace is used. API keys remain bound to their own workspace and cannot select another tenant.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Non-empty names without control characters; at most 12000 characters total.
Example
{ "datasetKind": "INVOICE_HISTORY", "headers": [ "Vendor Name", "Bill Number", "Invoice Date", "Gross Total" ], "consent": true}Responses
Section titled “Responses”A reviewable draft with only canonical Invogi field keys
object
object
A canonical field key belonging to the requested dataset.
Zero-based index into the exact submitted headers.
Required fields not covered by suggestions; existing editor mappings may already cover them.
Deterministic guidance about reviewing headers and choosing formats.
Example
{ "version": 1, "datasetKind": "INVOICE_HISTORY", "suggestions": [ { "field": "supplierName", "headerIndex": 0, "explanation": "Check that this is the vendor name." } ], "unmappedFields": [ "invoiceNumber", "issueDate", "grossAmount" ], "warnings": [ "Check each mapping against your source file." ]}Invalid request
API key lacks required scope/role
The workspace has used its rolling hourly request allowance. Retry-After reports the window.
Suggestions could not be prepared; manual mapping and current settings remain available.