Skip to content

Suggest import column mappings from headers (ANALYST+, dashboard user)

POST
/data-profiles/suggest-mapping
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.

X-Invogi-Organization
string format: uuid

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.

Media typeapplication/json
object
datasetKind
required
string
Allowed values: INVOICE_HISTORY SETTLED_PAYMENTS PAYMENT_PROPOSAL PURCHASE_ORDER_LINES GOODS_RECEIPT_LINES SUPPLIER_STATEMENT_ROWS OVERCHARGE_INVOICE_LINES AGREED_PRICE_SCHEDULE
headers
required

Non-empty names without control characters; at most 12000 characters total.

Array<string>
>= 1 items <= 200 items
consent
required
boolean

Example

{
"datasetKind": "INVOICE_HISTORY",
"headers": [
"Vendor Name",
"Bill Number",
"Invoice Date",
"Gross Total"
],
"consent": true
}

A reviewable draft with only canonical Invogi field keys

Media typeapplication/json
object
version
required
integer
Allowed value: 1
datasetKind
required
string
Allowed values: INVOICE_HISTORY SETTLED_PAYMENTS PAYMENT_PROPOSAL PURCHASE_ORDER_LINES GOODS_RECEIPT_LINES SUPPLIER_STATEMENT_ROWS OVERCHARGE_INVOICE_LINES AGREED_PRICE_SCHEDULE
suggestions
required
Array<object>
<= 25 items
object
field
required

A canonical field key belonging to the requested dataset.

string
<= 60 characters
headerIndex
required

Zero-based index into the exact submitted headers.

integer
<= 199
explanation
required
string
>= 1 characters <= 240 characters
unmappedFields
required

Required fields not covered by suggestions; existing editor mappings may already cover them.

Array<string>
warnings
required

Deterministic guidance about reviewing headers and choosing formats.

Array<string>

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

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: NOT_FOUND UNAUTHORIZED FORBIDDEN INVALID_REQUEST CONFLICT RATE_LIMITED USAGE_LIMIT_EXCEEDED PROCESSING_FAILED
message
required
string
request_id
required
string
details

Optional stable, content-free context, e.g. {reason, resets_at, preparation_id}.

object
key
additional properties
One of:
string

Example

{
"error": {
"code": "NOT_FOUND"
}
}

API key lacks required scope/role

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: NOT_FOUND UNAUTHORIZED FORBIDDEN INVALID_REQUEST CONFLICT RATE_LIMITED USAGE_LIMIT_EXCEEDED PROCESSING_FAILED
message
required
string
request_id
required
string
details

Optional stable, content-free context, e.g. {reason, resets_at, preparation_id}.

object
key
additional properties
One of:
string

Example

{
"error": {
"code": "NOT_FOUND"
}
}

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.