Ai API
Celerp AI API for ERP assistant conversations, document extraction, batch jobs, memory, usage, and user-confirmed business actions.
Generated from the Celerp 2.5.0 OpenAPI schema, 21 September 2026.
GET /ai/batch/{job_id}
Get AI Batch Job Status
Get batch job status and results.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
job_id | path | yes | string | Identifier of the AI processing job. |
Responses
| Status | Description | Body |
|---|---|---|
200 | Returns the requested AI batch job status result. | BatchJobOut |
422 | The request failed validation. The response lists each invalid field and why. | HTTPValidationError |
Example
curl -X GET http://localhost:8000/ai/batch/:job_id \
-H "Authorization: Bearer $TOKEN"GET /ai/conversations
List AI Conversations
List conversations, newest first, each with its count of open proposals.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
limit | query | -- | integer | Maximum number of records to return. |
offset | query | -- | integer | Number of matching records to skip before returning results. |
include_protected | query | -- | boolean | Whether to include protected AI conversations when permitted. |
Responses
| Status | Description | Body |
|---|---|---|
200 | Returns the requested AI conversations. | array of ConversationOut |
422 | The request failed validation. The response lists each invalid field and why. | HTTPValidationError |
Example
curl -X GET http://localhost:8000/ai/conversations \
-H "Authorization: Bearer $TOKEN"POST /ai/conversations
Create AI Conversation
Create a new conversation.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
title | string, optional | -- | Human-readable title for the record or conversation. |
Responses
| Status | Description | Body |
|---|---|---|
201 | Returns the created AI conversation or creation result. | ConversationOut |
422 | The request failed validation. The response lists each invalid field and why. | HTTPValidationError |
Example
curl -X POST http://localhost:8000/ai/conversations \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ ... }'GET /ai/conversations/{conversation_id}
Get AI Conversation
Get a conversation with its messages and the reading jobs started from it.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
conversation_id | path | yes | string | Identifier of the AI conversation. |
Responses
| Status | Description | Body |
|---|---|---|
200 | Returns the requested AI conversation result. | ConversationDetail |
422 | The request failed validation. The response lists each invalid field and why. | HTTPValidationError |
Example
curl -X GET http://localhost:8000/ai/conversations/:conversation_id \
-H "Authorization: Bearer $TOKEN"PATCH /ai/conversations/{conversation_id}
Rename AI Conversation
Rename a conversation.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
conversation_id | path | yes | string | Identifier of the AI conversation. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
title | string | yes | Human-readable title for the record or conversation. |
Responses
| Status | Description | Body |
|---|---|---|
200 | Returns the renamed conversation. | ConversationOut |
422 | The request failed validation. The response lists each invalid field and why. | HTTPValidationError |
Example
curl -X PATCH http://localhost:8000/ai/conversations/:conversation_id \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ ... }'DELETE /ai/conversations/{conversation_id}
Delete AI Conversation
Delete a conversation and all its messages.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
conversation_id | path | yes | string | Identifier of the AI conversation. |
Responses
| Status | Description | Body |
|---|---|---|
204 | Success. No response body is returned. | -- |
422 | The request failed validation. The response lists each invalid field and why. | HTTPValidationError |
Example
curl -X DELETE http://localhost:8000/ai/conversations/:conversation_id \
-H "Authorization: Bearer $TOKEN"POST /ai/conversations/{conversation_id}/confirm
Confirm AI-Proposed Action
Execute one pending AI-proposed business action that the user has explicitly confirmed.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
conversation_id | path | yes | string | Identifier of the AI conversation. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
message_id | string | yes | Identifier of the AI conversation message containing the proposal. |
tool_call_id | string | yes | Identifier of the specific AI-proposed action. |
Responses
| Status | Description | Body |
|---|---|---|
200 | Returns the result of the confirm AI-proposed action operation. | object |
422 | The request failed validation. The response lists each invalid field and why. | HTTPValidationError |
Example
curl -X POST http://localhost:8000/ai/conversations/:conversation_id/confirm \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ ... }'POST /ai/conversations/{conversation_id}/confirm-all
Confirm Multiple AI-Proposed Actions
Execute the selected pending AI-proposed actions for a message.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
conversation_id | path | yes | string | Identifier of the AI conversation. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
message_id | string | yes | Identifier of the AI conversation message containing the proposal. |
tool_call_ids | array of string, optional | -- | Identifiers of the AI-proposed actions to process. |
Responses
| Status | Description | Body |
|---|---|---|
200 | Returns the result of the confirm multiple AI-proposed actions operation. | object |
422 | The request failed validation. The response lists each invalid field and why. | HTTPValidationError |
Example
curl -X POST http://localhost:8000/ai/conversations/:conversation_id/confirm-all \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ ... }'POST /ai/conversations/{conversation_id}/dismiss
Dismiss AI-Proposed Action
Dismiss one pending AI-proposed action so it no longer appears as awaiting confirmation.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
conversation_id | path | yes | string | Identifier of the AI conversation. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
message_id | string | yes | Identifier of the AI conversation message containing the proposal. |
tool_call_id | string | yes | Identifier of the specific AI-proposed action. |
Responses
| Status | Description | Body |
|---|---|---|
200 | Returns the result of the dismiss AI-proposed action operation. | object |
422 | The request failed validation. The response lists each invalid field and why. | HTTPValidationError |
Example
curl -X POST http://localhost:8000/ai/conversations/:conversation_id/dismiss \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ ... }'POST /ai/conversations/{conversation_id}/dismiss-all
Dismiss Multiple AI-Proposed Actions
Dismiss the selected pending AI-proposed actions for a message.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
conversation_id | path | yes | string | Identifier of the AI conversation. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
message_id | string | yes | Identifier of the AI conversation message containing the proposal. |
tool_call_ids | array of string | yes | Identifiers of the AI-proposed actions to process. |
Responses
| Status | Description | Body |
|---|---|---|
200 | Returns the result of the dismiss multiple AI-proposed actions operation. | object |
422 | The request failed validation. The response lists each invalid field and why. | HTTPValidationError |
Example
curl -X POST http://localhost:8000/ai/conversations/:conversation_id/dismiss-all \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ ... }'POST /ai/conversations/{conversation_id}/jobs/{job_id}/proposals
Create Bill Proposals from AI Job
Convert a completed AI document-reading job into bill-related proposals for user review and confirmation. No business record is created until the relevant proposal is confirmed.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
conversation_id | path | yes | string | Identifier of the AI conversation. |
job_id | path | yes | string | Identifier of the AI processing job. |
Responses
| Status | Description | Body |
|---|---|---|
200 | Returns the created bill proposals from AI job or creation result. | object |
422 | The request failed validation. The response lists each invalid field and why. | HTTPValidationError |
Example
curl -X POST http://localhost:8000/ai/conversations/:conversation_id/jobs/:job_id/proposals \
-H "Authorization: Bearer $TOKEN"POST /ai/conversations/{conversation_id}/query
Send Message to AI Conversation
Send a message or supported files to an AI conversation. Read operations can return answers directly, while proposed business changes are returned for user confirmation.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
conversation_id | path | yes | string | Identifier of the AI conversation. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
query | string | -- | Natural-language question or search request. |
file_ids | array of string, optional | -- | Identifiers of uploaded files associated with the request. |
document_mode | string | -- | Optional document-processing mode to apply to attached files. |
Responses
| Status | Description | Body |
|---|---|---|
200 | Returns the assistant's reply, plus any proposed changes waiting for your confirmation. | -- |
422 | The request failed validation. The response lists each invalid field and why. | HTTPValidationError |
Example
curl -X POST http://localhost:8000/ai/conversations/:conversation_id/query \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ ... }'POST /ai/estimate-credits
Estimate AI Credit Usage
Estimate the current AI processing cost for the supplied files.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
file_ids | array of string | yes | Identifiers of uploaded files associated with the request. |
Responses
| Status | Description | Body |
|---|---|---|
200 | Returns the estimated number of credits the request would use. | EstimateResponse |
422 | The request failed validation. The response lists each invalid field and why. | HTTPValidationError |
Example
curl -X POST http://localhost:8000/ai/estimate-credits \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ ... }'GET /ai/file/{file_id}
Get AI Uploaded File
Retrieve a previously uploaded file.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
file_id | path | yes | string | Identifier of the uploaded or stored file. |
Responses
| Status | Description | Body |
|---|---|---|
200 | Returns the requested AI uploaded file result. | -- |
422 | The request failed validation. The response lists each invalid field and why. | HTTPValidationError |
Example
curl -X GET http://localhost:8000/ai/file/:file_id \
-H "Authorization: Bearer $TOKEN"GET /ai/memory
Get AI Memory
Return the per-company AI memory (notes and key-value facts).
Responses
| Status | Description | Body |
|---|---|---|
200 | Returns the requested AI memory result. | MemoryResponse |
Example
curl -X GET http://localhost:8000/ai/memory \
-H "Authorization: Bearer $TOKEN"DELETE /ai/memory
Clear AI Memory
Wipe all AI memory for this company.
Responses
| Status | Description | Body |
|---|---|---|
204 | Success. No response body is returned. | -- |
Example
curl -X DELETE http://localhost:8000/ai/memory \
-H "Authorization: Bearer $TOKEN"POST /ai/memory/kv
Set AI Memory Fact
Set a key-value fact in AI memory (max 100 keys).
Request body
| Field | Type | Required | Description |
|---|---|---|---|
key | string | yes | Key for the AI memory fact. |
value | string | yes | Value stored for the AI memory fact. |
Responses
| Status | Description | Body |
|---|---|---|
201 | Returns the created AI memory fact or creation result. | object |
422 | The request failed validation. The response lists each invalid field and why. | HTTPValidationError |
Example
curl -X POST http://localhost:8000/ai/memory/kv \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ ... }'POST /ai/memory/notes
Add AI Memory Note
Append a note to AI memory (max 50 notes, oldest trimmed).
Request body
| Field | Type | Required | Description |
|---|---|---|---|
content | string | yes | Text content to save as an AI memory note. |
Responses
| Status | Description | Body |
|---|---|---|
201 | Returns the created AI memory note or creation result. | object |
422 | The request failed validation. The response lists each invalid field and why. | HTTPValidationError |
Example
curl -X POST http://localhost:8000/ai/memory/notes \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ ... }'POST /ai/query
Run Read-Only AI ERP Query
Run a one-off, read-only natural-language query against the company's current ERP data.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
query | string | yes | Natural-language question or search request. |
file_ids | array of string, optional | -- | Identifiers of uploaded files associated with the request. |
Responses
| Status | Description | Body |
|---|---|---|
200 | Returns the result of the run read-only AI ERP query operation. | QueryResponse |
422 | The request failed validation. The response lists each invalid field and why. | HTTPValidationError |
Example
curl -X POST http://localhost:8000/ai/query \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ ... }'GET /ai/quota-status
Get AI Quota Status
Return the current AI usage allowance, consumption, and remaining capacity available to the company.
Responses
| Status | Description | Body |
|---|---|---|
200 | Returns the requested AI quota status result. | object |
Example
curl -X GET http://localhost:8000/ai/quota-status \
-H "Authorization: Bearer $TOKEN"POST /ai/upload
Upload Files for AI Processing
Upload files for AI batch processing. Returns list of file IDs.
Responses
| Status | Description | Body |
|---|---|---|
201 | Returns the created files for AI processing or creation result. | object |
422 | The request failed validation. The response lists each invalid field and why. | HTTPValidationError |
Example
curl -X POST http://localhost:8000/ai/upload \
-H "Authorization: Bearer $TOKEN"GET /ai/usage-stats
Get AI Usage Statistics
Return per-user AI usage statistics for the current calendar month.
Responses
| Status | Description | Body |
|---|---|---|
200 | Returns the requested AI usage statistics result. | object |
Example
curl -X GET http://localhost:8000/ai/usage-stats \
-H "Authorization: Bearer $TOKEN"