Skip to content

Analyze a previously uploaded invoice document

POST
/invoices/from-upload
curl --request POST \
--url https://api.invogi.com/v1/invoices/from-upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Prefer: respond-async' \
--data '{ "upload_id": "example", "purchase_order_ref": "example", "company_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "compliance_check_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'

Analyzes synchronously by default. Send Prefer: respond-async to request background analysis; when honored the response is UploadAnalysisQueued with Preference-Applied: respond-async, and progress is read from GET /uploads/{uploadId}/status.

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.

Prefer
string

Example

respond-async

RFC 7240 preference. respond-async opts into queued analysis.

Media typeapplication/json
object
upload_id
required
string
purchase_order_ref
string
company_id

Defaults to the default company

string format: uuid
compliance_check_id

The id of a compliance check of this same file. When the check ran in the last 24 hours, in the same billing period, on identical bytes, its usage is released once this upload is counted, so the two count as one invoice. An upload credits at most one check. Otherwise ignored.

string format: uuid

Example generated

{
"upload_id": "example",
"purchase_order_ref": "example",
"company_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"compliance_check_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"
}

Analysis result, or queued when Prefer: respond-async was honored

Media typeapplication/json
One of:
object
id
required
string format: uuid
status
required
string
Allowed value: COMPLETE
decision
required
string | null
Allowed values: PASS REVIEW BLOCK
risk_score
required
integer | null
<= 100
upload_id
string

Example

{
"status": "COMPLETE",
"decision": "PASS"
}
Preference-Applied
string

Present with respond-async only when the analysis was queued.

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"
}
}

Missing or invalid API key

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"
}
}

Resource not found

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"
}
}

Conflicting idempotency key or resource processing state

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"
}
}

Request-rate or customer-usage limit exceeded; inspect the stable error code

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"
}
}