curl --request POST \
--url http://localhost:3500/v1/agreements/{id}/price-imports \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"document_id": "11111111-1111-4111-8111-111111111111"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({document_id: '11111111-1111-4111-8111-111111111111'})
};
fetch('http://localhost:3500/v1/agreements/{id}/price-imports', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "http://localhost:3500/v1/agreements/{id}/price-imports"
payload = { "document_id": "11111111-1111-4111-8111-111111111111" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agreement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"worksheets": [
"<string>"
],
"instructions": "<string>",
"default_currency": "<string>",
"status": "queued",
"counts": {
"created": 1,
"duplicate": 1,
"invalid": 1
},
"failure": {
"code": "<string>",
"message": "<string>"
},
"workflow_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workflow_run_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agreement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"worksheets": [
"<string>"
],
"instructions": "<string>",
"default_currency": "<string>",
"status": "queued",
"counts": {
"created": 1,
"duplicate": 1,
"invalid": 1
},
"failure": {
"code": "<string>",
"message": "<string>"
},
"workflow_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workflow_run_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "validation_error",
"message": "Invalid request format, parameters, or body. Details contain up to 20 actionable field errors; the complete encoded request body must be at most 2 MiB (2,097,152 bytes).",
"request_id": "req_example"
}
}{
"error": {
"code": "invalid_token",
"message": "Missing or invalid bearer credential.",
"request_id": "req_example"
}
}{
"error": {
"code": "forbidden",
"message": "Access denied: forbidden, token_disabled, organization_required, insufficient_role, or mfa_required. Check the error code and effective permissions.",
"request_id": "req_example"
}
}{
"error": {
"code": "not_found",
"message": "The resource does not exist in the current organization.",
"request_id": "req_example"
}
}{
"error": {
"code": "conflict",
"message": "The Document bytes are missing or changed (source_unavailable), or the import ended while it was starting (Location names it).",
"request_id": "req_example"
}
}{
"error": {
"code": "unsupported_media_type",
"message": "The Document's declared media type cannot be imported.",
"request_id": "req_example"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "The IP or authenticated credential exceeded its request limit.",
"request_id": "req_example"
}
}{
"error": {
"code": "internal_error",
"message": "Unexpected server failure. Include the request ID when contacting support.",
"request_id": "req_example"
}
}{
"error": {
"code": "service_unavailable",
"message": "Authentication is unavailable or the import could not be confirmed as started. When Location is present, read the import before importing again.",
"request_id": "req_example"
}
}Import prices from a Document
Extracts the prices in one Document linked to this agreement and appends them, without review. Every extracted row gets an outcome: rows with the same product and price as an existing price or an earlier row are skipped as duplicates, rows that break the price rules are recorded as invalid, and the rest become new prices whose source is the Document. Once the import completes, download the extracted table with the outcome of every row. Existing prices are never changed. Supports PDF, XLSX, XLS, CSV, TSV, DOCX, PPTX, EML, MSG, plain text, PNG and JPEG Documents of up to 256 MiB, by declared media type. Importing the same file bytes with the same worksheets, instructions and default_currency again returns the existing import with 200 while it is queued, running or completed, and starts no work: a repeated extraction can word rows differently, and exact duplicate detection would miss them. A failed or cancelled import is retried by importing again. Poll the import until it is completed, failed or cancelled, and cancel it through its workflow run. The Document stays retained while an import references it.
curl --request POST \
--url http://localhost:3500/v1/agreements/{id}/price-imports \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"document_id": "11111111-1111-4111-8111-111111111111"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({document_id: '11111111-1111-4111-8111-111111111111'})
};
fetch('http://localhost:3500/v1/agreements/{id}/price-imports', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "http://localhost:3500/v1/agreements/{id}/price-imports"
payload = { "document_id": "11111111-1111-4111-8111-111111111111" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agreement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"worksheets": [
"<string>"
],
"instructions": "<string>",
"default_currency": "<string>",
"status": "queued",
"counts": {
"created": 1,
"duplicate": 1,
"invalid": 1
},
"failure": {
"code": "<string>",
"message": "<string>"
},
"workflow_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workflow_run_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agreement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"worksheets": [
"<string>"
],
"instructions": "<string>",
"default_currency": "<string>",
"status": "queued",
"counts": {
"created": 1,
"duplicate": 1,
"invalid": 1
},
"failure": {
"code": "<string>",
"message": "<string>"
},
"workflow_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workflow_run_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "validation_error",
"message": "Invalid request format, parameters, or body. Details contain up to 20 actionable field errors; the complete encoded request body must be at most 2 MiB (2,097,152 bytes).",
"request_id": "req_example"
}
}{
"error": {
"code": "invalid_token",
"message": "Missing or invalid bearer credential.",
"request_id": "req_example"
}
}{
"error": {
"code": "forbidden",
"message": "Access denied: forbidden, token_disabled, organization_required, insufficient_role, or mfa_required. Check the error code and effective permissions.",
"request_id": "req_example"
}
}{
"error": {
"code": "not_found",
"message": "The resource does not exist in the current organization.",
"request_id": "req_example"
}
}{
"error": {
"code": "conflict",
"message": "The Document bytes are missing or changed (source_unavailable), or the import ended while it was starting (Location names it).",
"request_id": "req_example"
}
}{
"error": {
"code": "unsupported_media_type",
"message": "The Document's declared media type cannot be imported.",
"request_id": "req_example"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "The IP or authenticated credential exceeded its request limit.",
"request_id": "req_example"
}
}{
"error": {
"code": "internal_error",
"message": "Unexpected server failure. Include the request ID when contacting support.",
"request_id": "req_example"
}
}{
"error": {
"code": "service_unavailable",
"message": "Authentication is unavailable or the import could not be confirmed as started. When Location is present, read the import before importing again.",
"request_id": "req_example"
}
}Authorizations
Personal API key. Send X-Organization-Id. The required cumulative level is listed in x-watchdog-permission.
Headers
Required for personal API keys. Target one organization you have access to. Migrated keys may omit it to use their original organization. For Clerk sessions, it must match the active organization.
Path Parameters
Body
A Document linked to this agreement.
Excel worksheets to read, by exact name. Only for XLSX and XLS Documents; null reads every worksheet.
1 - 500 elements1 - 31Guidance for reading this document, e.g. which table or price column applies.
20000ISO 4217 currency for created amount prices whose source states none. Rows keep the source currency.
^[A-Z]{3}$Response
An import of the same bytes and settings already exists and is queued, running or completed. No work started.
The Document the prices were extracted from.
completed means the new prices are appended and the price table is written, in one transaction. Failed and cancelled imports append nothing.
queued, running, completed, failed, cancelled Row outcomes, set when the import completes; null before and on failure.
Show child attributes
Show child attributes
extraction_incomplete, extraction_failed, agreement_busy or agreement_deleted. dispatch_failed or admission_expired: processing never started. execution_incomplete: processing ended without a result. Import again in every case.
Show child attributes
Show child attributes