REST API

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

NameInRequiredTypeDescription
job_idpathyesstringIdentifier of the AI processing job.

Responses

StatusDescriptionBody
200Returns the requested AI batch job status result.BatchJobOut
422The 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

NameInRequiredTypeDescription
limitquery--integerMaximum number of records to return.
offsetquery--integerNumber of matching records to skip before returning results.
include_protectedquery--booleanWhether to include protected AI conversations when permitted.

Responses

StatusDescriptionBody
200Returns the requested AI conversations.array of ConversationOut
422The 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

FieldTypeRequiredDescription
titlestring, optional--Human-readable title for the record or conversation.

Responses

StatusDescriptionBody
201Returns the created AI conversation or creation result.ConversationOut
422The 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

NameInRequiredTypeDescription
conversation_idpathyesstringIdentifier of the AI conversation.

Responses

StatusDescriptionBody
200Returns the requested AI conversation result.ConversationDetail
422The 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

NameInRequiredTypeDescription
conversation_idpathyesstringIdentifier of the AI conversation.

Request body

FieldTypeRequiredDescription
titlestringyesHuman-readable title for the record or conversation.

Responses

StatusDescriptionBody
200Returns the renamed conversation.ConversationOut
422The 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

NameInRequiredTypeDescription
conversation_idpathyesstringIdentifier of the AI conversation.

Responses

StatusDescriptionBody
204Success. No response body is returned.--
422The 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

NameInRequiredTypeDescription
conversation_idpathyesstringIdentifier of the AI conversation.

Request body

FieldTypeRequiredDescription
message_idstringyesIdentifier of the AI conversation message containing the proposal.
tool_call_idstringyesIdentifier of the specific AI-proposed action.

Responses

StatusDescriptionBody
200Returns the result of the confirm AI-proposed action operation.object
422The 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

NameInRequiredTypeDescription
conversation_idpathyesstringIdentifier of the AI conversation.

Request body

FieldTypeRequiredDescription
message_idstringyesIdentifier of the AI conversation message containing the proposal.
tool_call_idsarray of string, optional--Identifiers of the AI-proposed actions to process.

Responses

StatusDescriptionBody
200Returns the result of the confirm multiple AI-proposed actions operation.object
422The 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

NameInRequiredTypeDescription
conversation_idpathyesstringIdentifier of the AI conversation.

Request body

FieldTypeRequiredDescription
message_idstringyesIdentifier of the AI conversation message containing the proposal.
tool_call_idstringyesIdentifier of the specific AI-proposed action.

Responses

StatusDescriptionBody
200Returns the result of the dismiss AI-proposed action operation.object
422The 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

NameInRequiredTypeDescription
conversation_idpathyesstringIdentifier of the AI conversation.

Request body

FieldTypeRequiredDescription
message_idstringyesIdentifier of the AI conversation message containing the proposal.
tool_call_idsarray of stringyesIdentifiers of the AI-proposed actions to process.

Responses

StatusDescriptionBody
200Returns the result of the dismiss multiple AI-proposed actions operation.object
422The 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

NameInRequiredTypeDescription
conversation_idpathyesstringIdentifier of the AI conversation.
job_idpathyesstringIdentifier of the AI processing job.

Responses

StatusDescriptionBody
200Returns the created bill proposals from AI job or creation result.object
422The 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

NameInRequiredTypeDescription
conversation_idpathyesstringIdentifier of the AI conversation.

Request body

FieldTypeRequiredDescription
querystring--Natural-language question or search request.
file_idsarray of string, optional--Identifiers of uploaded files associated with the request.
document_modestring--Optional document-processing mode to apply to attached files.

Responses

StatusDescriptionBody
200Returns the assistant's reply, plus any proposed changes waiting for your confirmation.--
422The 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

FieldTypeRequiredDescription
file_idsarray of stringyesIdentifiers of uploaded files associated with the request.

Responses

StatusDescriptionBody
200Returns the estimated number of credits the request would use.EstimateResponse
422The 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

NameInRequiredTypeDescription
file_idpathyesstringIdentifier of the uploaded or stored file.

Responses

StatusDescriptionBody
200Returns the requested AI uploaded file result.--
422The 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

StatusDescriptionBody
200Returns 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

StatusDescriptionBody
204Success. 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

FieldTypeRequiredDescription
keystringyesKey for the AI memory fact.
valuestringyesValue stored for the AI memory fact.

Responses

StatusDescriptionBody
201Returns the created AI memory fact or creation result.object
422The 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

FieldTypeRequiredDescription
contentstringyesText content to save as an AI memory note.

Responses

StatusDescriptionBody
201Returns the created AI memory note or creation result.object
422The 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

FieldTypeRequiredDescription
querystringyesNatural-language question or search request.
file_idsarray of string, optional--Identifiers of uploaded files associated with the request.

Responses

StatusDescriptionBody
200Returns the result of the run read-only AI ERP query operation.QueryResponse
422The 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

StatusDescriptionBody
200Returns 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

StatusDescriptionBody
201Returns the created files for AI processing or creation result.object
422The 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

StatusDescriptionBody
200Returns the requested AI usage statistics result.object

Example

curl -X GET http://localhost:8000/ai/usage-stats \
  -H "Authorization: Bearer $TOKEN"