@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api Mistral AI API
@base https://api.mistral.ai
@version 1.0.0
@auth Bearer bearer
@endpoints 154
@hint download_for_search
@toc models(3), conversations(10), agents(12), conversations#stream(1), files(6), fine_tuning(8), batch(4), chat(3), fim(1), embeddings(1), moderations(1), ocr(1), classifications(1), audio(9), libraries(18), observability(41), workflows(34)

@group models
@endpoint GET /v1/models
@optional {provider: any, model: any}
@returns(200) {object: str, data: [any]}
@errors {422}

@endpoint GET /v1/models/{model_id}
@required {model_id: str}
@returns(200)
@errors {422}

@endpoint DELETE /v1/models/{model_id}
@required {model_id: str}
@returns(200) {id: str, object: str, deleted: bool}
@errors {422}

@endgroup

@group conversations
@endpoint POST /v1/conversations
@returns(200) {object: str, conversation_id: str, outputs: [any], usage: map{prompt_tokens: int, completion_tokens: int, total_tokens: int, connector_tokens: any, connectors: any}, guardrails: any}
@errors {422}

@endpoint GET /v1/conversations
@optional {page: int=0, page_size: int=100, metadata: any}
@returns(200)
@errors {422}

@endpoint GET /v1/conversations/{conversation_id}
@required {conversation_id: str}
@returns(200)
@errors {422}

@endpoint DELETE /v1/conversations/{conversation_id}
@required {conversation_id: str}
@returns(204)
@errors {422}

@endpoint POST /v1/conversations/{conversation_id}
@required {conversation_id: str}
@returns(200) {object: str, conversation_id: str, outputs: [any], usage: map{prompt_tokens: int, completion_tokens: int, total_tokens: int, connector_tokens: any, connectors: any}, guardrails: any}
@errors {422}

@endpoint GET /v1/conversations/{conversation_id}/history
@required {conversation_id: str}
@returns(200) {object: str, conversation_id: str, entries: [any]}
@errors {422}

@endpoint GET /v1/conversations/{conversation_id}/messages
@required {conversation_id: str}
@returns(200) {object: str, conversation_id: str, messages: [any]}
@errors {422}

@endpoint POST /v1/conversations/{conversation_id}/restart
@required {conversation_id: str}
@returns(200) {object: str, conversation_id: str, outputs: [any], usage: map{prompt_tokens: int, completion_tokens: int, total_tokens: int, connector_tokens: any, connectors: any}, guardrails: any}
@errors {422}

@endgroup

@group agents
@endpoint POST /v1/agents
@required {model: str, name: str}
@optional {instructions: any, tools: [any], completion_args: map{stop: any, presence_penalty: any, frequency_penalty: any, temperature: any, top_p: any, max_tokens: any, random_seed: any, prediction: any, response_format: any, tool_choice: str, reasoning_effort: any}, guardrails: any, description: any, handoffs: any, metadata: any, version_message: any}
@returns(200) {instructions: any, tools: [any], completion_args: map{stop: any, presence_penalty: any, frequency_penalty: any, temperature: any, top_p: any, max_tokens: any, random_seed: any, prediction: any, response_format: any, tool_choice: str, reasoning_effort: any}, guardrails: any, model: str, name: str, description: any, handoffs: any, metadata: any, object: str, id: str, version: int, versions: [int], created_at: str(date-time), updated_at: str(date-time), deployment_chat: bool, source: str, version_message: any}
@errors {422}

@endpoint GET /v1/agents
@optional {page: int=0, page_size: int=20, deployment_chat: any, sources: any, name: any, search: any, id: any, metadata: any}
@returns(200)
@errors {422}

@endpoint GET /v1/agents/{agent_id}
@required {agent_id: str}
@optional {agent_version: any}
@returns(200) {instructions: any, tools: [any], completion_args: map{stop: any, presence_penalty: any, frequency_penalty: any, temperature: any, top_p: any, max_tokens: any, random_seed: any, prediction: any, response_format: any, tool_choice: str, reasoning_effort: any}, guardrails: any, model: str, name: str, description: any, handoffs: any, metadata: any, object: str, id: str, version: int, versions: [int], created_at: str(date-time), updated_at: str(date-time), deployment_chat: bool, source: str, version_message: any}
@errors {422}

@endpoint PATCH /v1/agents/{agent_id}
@required {agent_id: str}
@optional {instructions: any, tools: [any], completion_args: map{stop: any, presence_penalty: any, frequency_penalty: any, temperature: any, top_p: any, max_tokens: any, random_seed: any, prediction: any, response_format: any, tool_choice: str, reasoning_effort: any}, guardrails: any, model: any, name: any, description: any, handoffs: any, deployment_chat: any, metadata: any, version_message: any}
@returns(200) {instructions: any, tools: [any], completion_args: map{stop: any, presence_penalty: any, frequency_penalty: any, temperature: any, top_p: any, max_tokens: any, random_seed: any, prediction: any, response_format: any, tool_choice: str, reasoning_effort: any}, guardrails: any, model: str, name: str, description: any, handoffs: any, metadata: any, object: str, id: str, version: int, versions: [int], created_at: str(date-time), updated_at: str(date-time), deployment_chat: bool, source: str, version_message: any}
@errors {422}

@endpoint DELETE /v1/agents/{agent_id}
@required {agent_id: str}
@returns(204)
@errors {422}

@endpoint PATCH /v1/agents/{agent_id}/version
@required {agent_id: str, version: int}
@returns(200) {instructions: any, tools: [any], completion_args: map{stop: any, presence_penalty: any, frequency_penalty: any, temperature: any, top_p: any, max_tokens: any, random_seed: any, prediction: any, response_format: any, tool_choice: str, reasoning_effort: any}, guardrails: any, model: str, name: str, description: any, handoffs: any, metadata: any, object: str, id: str, version: int, versions: [int], created_at: str(date-time), updated_at: str(date-time), deployment_chat: bool, source: str, version_message: any}
@errors {422}

@endpoint GET /v1/agents/{agent_id}/versions
@required {agent_id: str}
@optional {page: int=0, page_size: int=20}
@returns(200)
@errors {422}

@endpoint GET /v1/agents/{agent_id}/versions/{version}
@required {agent_id: str, version: str}
@returns(200) {instructions: any, tools: [any], completion_args: map{stop: any, presence_penalty: any, frequency_penalty: any, temperature: any, top_p: any, max_tokens: any, random_seed: any, prediction: any, response_format: any, tool_choice: str, reasoning_effort: any}, guardrails: any, model: str, name: str, description: any, handoffs: any, metadata: any, object: str, id: str, version: int, versions: [int], created_at: str(date-time), updated_at: str(date-time), deployment_chat: bool, source: str, version_message: any}
@errors {422}

@endpoint PUT /v1/agents/{agent_id}/aliases
@required {agent_id: str, alias: str, version: int}
@returns(200) {alias: str, version: int, created_at: str(date-time), updated_at: str(date-time)}
@errors {422}

@endpoint GET /v1/agents/{agent_id}/aliases
@required {agent_id: str}
@returns(200)
@errors {422}

@endpoint DELETE /v1/agents/{agent_id}/aliases
@required {agent_id: str, alias: str}
@returns(204)
@errors {422}

@endgroup

@group conversations#stream
@endpoint POST /v1/conversations#stream
@returns(200)
@errors {422}

@endgroup

@group conversations
@endpoint POST /v1/conversations/{conversation_id}#stream
@required {conversation_id: str}
@returns(200)
@errors {422}

@endpoint POST /v1/conversations/{conversation_id}/restart#stream
@required {conversation_id: str}
@returns(200)
@errors {422}

@endgroup

@group files
@endpoint POST /v1/files
@returns(200) {id: str(uuid), object: str, bytes: int, created_at: int, filename: str, purpose: str, sample_type: str, num_lines: any, mimetype: any, source: str, signature: any, expires_at: any, visibility: any}

@endpoint GET /v1/files
@optional {page: int=0, page_size: int=100, include_total: bool=true, sample_type: any, source: any, search: any, purpose: any, mimetypes: any}
@returns(200) {data: [map], object: str, total: any}

@endpoint GET /v1/files/{file_id}
@required {file_id: str(uuid)}
@returns(200) {id: str(uuid), object: str, bytes: int, created_at: int, filename: str, purpose: str, sample_type: str, num_lines: any, mimetype: any, source: str, signature: any, expires_at: any, visibility: any, deleted: bool}

@endpoint DELETE /v1/files/{file_id}
@required {file_id: str(uuid)}
@returns(200) {id: str(uuid), object: str, deleted: bool}

@endpoint GET /v1/files/{file_id}/content
@required {file_id: str(uuid)}
@returns(200)

@endpoint GET /v1/files/{file_id}/url
@required {file_id: str(uuid)}
@optional {expiry: int=24}
@returns(200) {url: str}

@endgroup

@group fine_tuning
@endpoint GET /v1/fine_tuning/jobs
@optional {page: int=0, page_size: int=100, model: any, created_after: any, created_before: any, created_by_me: bool=false, status: any, wandb_project: any, wandb_name: any, suffix: any}
@returns(200) {data: [any], object: str, total: int}

@endpoint POST /v1/fine_tuning/jobs
@required {model: str, hyperparameters: any}
@optional {dry_run: any, training_files: [map{file_id!: str(uuid), weight: num}]=, validation_files: any, suffix: any, integrations: any, auto_start: bool, invalid_sample_skip_percentage: num=0, job_type: any, repositories: any, classifier_targets: any}
@returns(200)

@endpoint GET /v1/fine_tuning/jobs/{job_id}
@required {job_id: str(uuid)}
@returns(200)

@endpoint POST /v1/fine_tuning/jobs/{job_id}/cancel
@required {job_id: str(uuid)}
@returns(200)

@endpoint POST /v1/fine_tuning/jobs/{job_id}/start
@required {job_id: str(uuid)}
@returns(200)

@endpoint PATCH /v1/fine_tuning/models/{model_id}
@required {model_id: str}
@optional {name: any, description: any}
@returns(200)

@endpoint POST /v1/fine_tuning/models/{model_id}/archive
@required {model_id: str}
@returns(200) {id: str, object: str, archived: bool}

@endpoint DELETE /v1/fine_tuning/models/{model_id}/archive
@required {model_id: str}
@returns(200) {id: str, object: str, archived: bool}

@endgroup

@group batch
@endpoint GET /v1/batch/jobs
@optional {page: int=0, page_size: int=100, model: any, agent_id: any, metadata: any, created_after: any, created_by_me: bool=false, status: any, order_by: str(created/-created)=-created}
@returns(200) {data: [map], object: str, total: int}

@endpoint POST /v1/batch/jobs
@required {endpoint: str(/v1/chat/completions//v1/embeddings//v1/fim/completions//v1/moderations//v1/chat/moderations//v1/ocr//v1/classifications//v1/chat/classifications//v1/conversations//v1/audio/transcriptions)}
@optional {input_files: any, requests: any, model: any, agent_id: any, metadata: any, timeout_hours: int=24}
@returns(200) {id: str, object: str, input_files: [str(uuid)], metadata: any, endpoint: str, model: any, agent_id: any, output_file: any, error_file: any, errors: [map], outputs: any, status: str, created_at: int, total_requests: int, completed_requests: int, succeeded_requests: int, failed_requests: int, started_at: any, completed_at: any}

@endpoint GET /v1/batch/jobs/{job_id}
@required {job_id: str(uuid)}
@optional {inline: any}
@returns(200) {id: str, object: str, input_files: [str(uuid)], metadata: any, endpoint: str, model: any, agent_id: any, output_file: any, error_file: any, errors: [map], outputs: any, status: str, created_at: int, total_requests: int, completed_requests: int, succeeded_requests: int, failed_requests: int, started_at: any, completed_at: any}

@endpoint POST /v1/batch/jobs/{job_id}/cancel
@required {job_id: str(uuid)}
@returns(200) {id: str, object: str, input_files: [str(uuid)], metadata: any, endpoint: str, model: any, agent_id: any, output_file: any, error_file: any, errors: [map], outputs: any, status: str, created_at: int, total_requests: int, completed_requests: int, succeeded_requests: int, failed_requests: int, started_at: any, completed_at: any}

@endgroup

@group chat
@endpoint POST /v1/chat/completions
@required {model: str, messages: [any]}
@optional {temperature: any, top_p: num=1, max_tokens: any, stream: bool=false, stop: any, random_seed: any, metadata: any, response_format: map{type: str, json_schema: any}, tools: any, tool_choice: any=auto, presence_penalty: num=0, frequency_penalty: num=0, n: any, prediction: map{type: str, content: str}, parallel_tool_calls: bool=true, prompt_mode: any, reasoning_effort: str(high/none), guardrails: any=null, safe_prompt: bool=false}
@returns(200)
@errors {422}

@endgroup

@group fim
@endpoint POST /v1/fim/completions
@required {model: str=codestral-2404, prompt: str}
@optional {temperature: any, top_p: num=1, max_tokens: any, stream: bool=false, stop: any, random_seed: any, metadata: any, suffix: any=, min_tokens: any}
@returns(200)
@errors {422}

@endgroup

@group agents
@endpoint POST /v1/agents/completions
@required {messages: [any], agent_id: str}
@optional {max_tokens: any, stream: bool=false, stop: any, random_seed: any, metadata: any, response_format: map{type: str, json_schema: any}, tools: any, tool_choice: any=auto, presence_penalty: num=0, frequency_penalty: num=0, n: any, prediction: map{type: str, content: str}, parallel_tool_calls: bool=true, prompt_mode: any, reasoning_effort: str(high/none)}
@returns(200)
@errors {422}

@endgroup

@group embeddings
@endpoint POST /v1/embeddings
@required {model: str, input: any}
@optional {metadata: any, output_dimension: any, output_dtype: str(float/int8/uint8/binary/ubinary), encoding_format: str(float/base64)}
@returns(200)
@errors {422}

@endgroup

@group moderations
@endpoint POST /v1/moderations
@required {model: str, input: any}
@optional {metadata: any}
@returns(200) {id: str, model: str, results: [map]}
@errors {422}

@endgroup

@group chat
@endpoint POST /v1/chat/moderations
@required {input: any, model: str}
@returns(200) {id: str, model: str, results: [map]}
@errors {422}

@endgroup

@group ocr
@endpoint POST /v1/ocr
@required {model: any, document: any}
@optional {id: str, pages: any, include_image_base64: any, image_limit: any, image_min_size: any, bbox_annotation_format: any, document_annotation_format: any, document_annotation_prompt: any, table_format: any, extract_header: bool=false, extract_footer: bool=false}
@returns(200) {pages: [map], model: str, document_annotation: any, usage_info: map{pages_processed: int, doc_size_bytes: any}}
@errors {422}

@endgroup

@group classifications
@endpoint POST /v1/classifications
@required {model: str, input: any}
@optional {metadata: any}
@returns(200) {id: str, model: str, results: [map]}
@errors {422}

@endgroup

@group chat
@endpoint POST /v1/chat/classifications
@required {model: str, input: any}
@returns(200) {id: str, model: str, results: [map]}
@errors {422}

@endgroup

@group audio
@endpoint POST /v1/audio/transcriptions
@returns(200) {model: str, text: str, language: any, segments: [map], usage: map{prompt_tokens: int, completion_tokens: int, total_tokens: int, prompt_audio_seconds: any, num_cached_tokens: any, prompt_tokens_details: any, prompt_token_details: any}}

@endpoint POST /v1/audio/transcriptions#stream
@returns(200)

@endpoint POST /v1/audio/speech
@required {input: str}
@optional {model: any, stream: bool=false, voice_id: any, ref_audio: any, response_format: str(pcm/wav/mp3/flac/opus)}
@returns(200) {audio_data: str}
@errors {422}

@endpoint GET /v1/audio/voices
@optional {limit: int=10, offset: int=0}
@returns(200) {items: [map], total: int, page: int, page_size: int, total_pages: int}
@errors {422}

@endpoint POST /v1/audio/voices
@required {name: str, sample_audio: str}
@optional {slug: any, languages: [str]=, gender: any, age: any, tags: any, color: any, retention_notice: int=30, sample_filename: any}
@returns(200) {name: str, slug: any, languages: [str], gender: any, age: any, tags: any, color: any, retention_notice: int, id: str(uuid), created_at: str(date-time), user_id: any}
@errors {422}

@endpoint GET /v1/audio/voices/{voice_id}
@required {voice_id: str}
@returns(200) {name: str, slug: any, languages: [str], gender: any, age: any, tags: any, color: any, retention_notice: int, id: str(uuid), created_at: str(date-time), user_id: any}
@errors {422}

@endpoint PATCH /v1/audio/voices/{voice_id}
@required {voice_id: str(uuid)}
@optional {name: any, languages: any, gender: any, age: any, tags: any}
@returns(200) {name: str, slug: any, languages: [str], gender: any, age: any, tags: any, color: any, retention_notice: int, id: str(uuid), created_at: str(date-time), user_id: any}
@errors {422}

@endpoint DELETE /v1/audio/voices/{voice_id}
@required {voice_id: str(uuid)}
@returns(200) {name: str, slug: any, languages: [str], gender: any, age: any, tags: any, color: any, retention_notice: int, id: str(uuid), created_at: str(date-time), user_id: any}
@errors {422}

@endpoint GET /v1/audio/voices/{voice_id}/sample
@required {voice_id: str}
@returns(200)
@errors {422}

@endgroup

@group libraries
@endpoint GET /v1/libraries
@returns(200) {data: [map]}

@endpoint POST /v1/libraries
@required {name: str}
@optional {description: any, chunk_size: any}
@returns(201) {id: str(uuid), name: str, created_at: str(date-time), updated_at: str(date-time), owner_id: any, owner_type: str, total_size: int, nb_documents: int, chunk_size: any, emoji: any, description: any, generated_description: any, explicit_user_members_count: any, explicit_workspace_members_count: any, org_sharing_role: any, generated_name: any}
@errors {422}

@endpoint GET /v1/libraries/{library_id}
@required {library_id: str(uuid)}
@returns(200) {id: str(uuid), name: str, created_at: str(date-time), updated_at: str(date-time), owner_id: any, owner_type: str, total_size: int, nb_documents: int, chunk_size: any, emoji: any, description: any, generated_description: any, explicit_user_members_count: any, explicit_workspace_members_count: any, org_sharing_role: any, generated_name: any}
@errors {422}

@endpoint DELETE /v1/libraries/{library_id}
@required {library_id: str(uuid)}
@returns(200) {id: str(uuid), name: str, created_at: str(date-time), updated_at: str(date-time), owner_id: any, owner_type: str, total_size: int, nb_documents: int, chunk_size: any, emoji: any, description: any, generated_description: any, explicit_user_members_count: any, explicit_workspace_members_count: any, org_sharing_role: any, generated_name: any}
@errors {422}

@endpoint PUT /v1/libraries/{library_id}
@required {library_id: str(uuid)}
@optional {name: any, description: any}
@returns(200) {id: str(uuid), name: str, created_at: str(date-time), updated_at: str(date-time), owner_id: any, owner_type: str, total_size: int, nb_documents: int, chunk_size: any, emoji: any, description: any, generated_description: any, explicit_user_members_count: any, explicit_workspace_members_count: any, org_sharing_role: any, generated_name: any}
@errors {422}

@endpoint GET /v1/libraries/{library_id}/documents
@required {library_id: str(uuid)}
@optional {search: any, page_size: int=100, page: int=0, filters_attributes: any, sort_by: str=created_at, sort_order: str=desc}
@returns(200) {pagination: map{total_items: int, total_pages: int, current_page: int, page_size: int, has_more: bool}, data: [map]}
@errors {422}

@endpoint POST /v1/libraries/{library_id}/documents
@required {library_id: str(uuid)}
@returns(200) {id: str(uuid), library_id: str(uuid), hash: any, mime_type: any, extension: any, size: any, name: str, summary: any, created_at: str(date-time), last_processed_at: any, number_of_pages: any, process_status: str, uploaded_by_id: any, uploaded_by_type: str, tokens_processing_main_content: any, tokens_processing_summary: any, url: any, attributes: any, processing_status: str, tokens_processing_total: int}
@returns(201) {id: str(uuid), library_id: str(uuid), hash: any, mime_type: any, extension: any, size: any, name: str, summary: any, created_at: str(date-time), last_processed_at: any, number_of_pages: any, process_status: str, uploaded_by_id: any, uploaded_by_type: str, tokens_processing_main_content: any, tokens_processing_summary: any, url: any, attributes: any, processing_status: str, tokens_processing_total: int}
@errors {422}

@endpoint GET /v1/libraries/{library_id}/documents/{document_id}
@required {library_id: str(uuid), document_id: str(uuid)}
@returns(200) {id: str(uuid), library_id: str(uuid), hash: any, mime_type: any, extension: any, size: any, name: str, summary: any, created_at: str(date-time), last_processed_at: any, number_of_pages: any, process_status: str, uploaded_by_id: any, uploaded_by_type: str, tokens_processing_main_content: any, tokens_processing_summary: any, url: any, attributes: any, processing_status: str, tokens_processing_total: int}
@errors {422}

@endpoint PUT /v1/libraries/{library_id}/documents/{document_id}
@required {library_id: str(uuid), document_id: str(uuid)}
@optional {name: any, attributes: any}
@returns(200) {id: str(uuid), library_id: str(uuid), hash: any, mime_type: any, extension: any, size: any, name: str, summary: any, created_at: str(date-time), last_processed_at: any, number_of_pages: any, process_status: str, uploaded_by_id: any, uploaded_by_type: str, tokens_processing_main_content: any, tokens_processing_summary: any, url: any, attributes: any, processing_status: str, tokens_processing_total: int}
@errors {422}

@endpoint DELETE /v1/libraries/{library_id}/documents/{document_id}
@required {library_id: str(uuid), document_id: str(uuid)}
@returns(204)
@errors {422}

@endpoint GET /v1/libraries/{library_id}/documents/{document_id}/text_content
@required {library_id: str(uuid), document_id: str(uuid)}
@returns(200) {text: str}
@errors {422}

@endpoint GET /v1/libraries/{library_id}/documents/{document_id}/status
@required {library_id: str(uuid), document_id: str(uuid)}
@returns(200) {document_id: str(uuid), process_status: str, processing_status: str}
@errors {422}

@endpoint GET /v1/libraries/{library_id}/documents/{document_id}/signed-url
@required {library_id: str(uuid), document_id: str(uuid)}
@returns(200)
@errors {422}

@endpoint GET /v1/libraries/{library_id}/documents/{document_id}/extracted-text-signed-url
@required {library_id: str(uuid), document_id: str(uuid)}
@returns(200)
@errors {422}

@endpoint POST /v1/libraries/{library_id}/documents/{document_id}/reprocess
@required {library_id: str(uuid), document_id: str(uuid)}
@returns(204)
@errors {422}

@endpoint GET /v1/libraries/{library_id}/share
@required {library_id: str(uuid)}
@returns(200) {data: [map]}
@errors {422}

@endpoint PUT /v1/libraries/{library_id}/share
@required {library_id: str(uuid), level: str(Viewer/Editor), share_with_uuid: str(uuid), share_with_type: str(User/Workspace/Org)}
@optional {org_id: any}
@returns(200) {library_id: str(uuid), user_id: any, org_id: str(uuid), role: str, share_with_type: str, share_with_uuid: any}
@errors {422}

@endpoint DELETE /v1/libraries/{library_id}/share
@required {library_id: str(uuid), share_with_uuid: str(uuid), share_with_type: str(User/Workspace/Org)}
@optional {org_id: any}
@returns(200) {library_id: str(uuid), user_id: any, org_id: str(uuid), role: str, share_with_type: str, share_with_uuid: any}
@errors {422}

@endgroup

@group observability
@endpoint POST /v1/observability/chat-completion-events/search
@required {search_params: map{filters!: any}}
@optional {page_size: int=50, cursor: any, extra_fields: any}
@returns(200) {completion_events: map{results: [map], next: any, cursor: any}}
@errors {400, 404, 408, 409, 422}

@endpoint POST /v1/observability/chat-completion-events/search-ids
@required {search_params: map{filters!: any}}
@optional {extra_fields: any}
@returns(200) {completion_event_ids: [str]}
@errors {400, 404, 408, 409, 422}

@endpoint GET /v1/observability/chat-completion-events/{event_id}
@required {event_id: str(uuid)}
@returns(200) {event_id: str, correlation_id: str, created_at: str(date-time), extra_fields: map, nb_input_tokens: int, nb_output_tokens: int, enabled_tools: [map], request_messages: [map], response_messages: [map], nb_messages: int, chat_transcription_events: [map]}
@errors {400, 404, 408, 409, 422}

@endpoint GET /v1/observability/chat-completion-events/{event_id}/similar-events
@required {event_id: str(uuid)}
@returns(200) {completion_events: map{results: [map], next: any, cursor: any}}
@errors {400, 404, 408, 409, 422}

@endpoint GET /v1/observability/chat-completion-fields
@returns(200) {field_definitions: [map], field_groups: [map]}
@errors {400, 404, 408, 409, 422}

@endpoint GET /v1/observability/chat-completion-fields/{field_name}/options
@required {field_name: str, operator: str(lt/lte/gt/gte/startswith/istartswith/endswith/iendswith/contains/icontains/matches/notcontains/inotcontains/eq/neq/isnull/includes/excludes/len_eq)}
@returns(200) {options: any}
@errors {400, 404, 408, 409, 422}

@endpoint POST /v1/observability/chat-completion-fields/{field_name}/options-counts
@required {field_name: str}
@optional {filter_params: any}
@returns(200) {counts: [map]}
@errors {400, 404, 408, 409, 422}

@endpoint POST /v1/observability/chat-completion-events/{event_id}/live-judging
@required {event_id: str(uuid), judge_definition: map{name!: str, description!: str, model_name!: str, output!: any, instructions!: str, tools!: [str]}}
@returns(200) {analysis: str, answer: any}
@errors {400, 404, 408, 409, 422}

@endpoint POST /v1/observability/judges
@required {name: str, description: str, model_name: str, output: any, instructions: str, tools: [str]}
@returns(201) {id: str(uuid), created_at: str(date-time), updated_at: str(date-time), deleted_at: any, owner_id: str(uuid), workspace_id: str(uuid), name: str, description: str, model_name: str, output: any, instructions: str, tools: [str], up_revision: any, down_revision: any, base_revision: any}
@errors {400, 404, 408, 409, 422}

@endpoint GET /v1/observability/judges
@optional {type_filter: any, model_filter: any, page_size: int=50, page: int=1, q: any}
@returns(200) {judges: map{results: [map], count: int, next: any, previous: any}}
@errors {400, 404, 408, 409, 422}

@endpoint GET /v1/observability/judges/{judge_id}
@required {judge_id: str(uuid)}
@returns(200) {id: str(uuid), created_at: str(date-time), updated_at: str(date-time), deleted_at: any, owner_id: str(uuid), workspace_id: str(uuid), name: str, description: str, model_name: str, output: any, instructions: str, tools: [str], up_revision: any, down_revision: any, base_revision: any}
@errors {400, 404, 408, 409, 422}

@endpoint DELETE /v1/observability/judges/{judge_id}
@required {judge_id: str(uuid)}
@returns(204)
@errors {400, 404, 408, 409, 422}

@endpoint PUT /v1/observability/judges/{judge_id}
@required {judge_id: str(uuid), name: str, description: str, model_name: str, output: any, instructions: str, tools: [str]}
@returns(204)
@errors {400, 404, 408, 409, 422}

@endpoint POST /v1/observability/judges/{judge_id}/live-judging
@required {judge_id: str(uuid), messages: [map]}
@optional {properties: any}
@returns(200) {analysis: str, answer: any}
@errors {400, 404, 408, 409, 422}

@endpoint POST /v1/observability/campaigns
@required {search_params: map{filters!: any}, judge_id: str(uuid), name: str, description: str, max_nb_events: int}
@returns(201) {id: str(uuid), created_at: str(date-time), updated_at: str(date-time), deleted_at: any, name: str, owner_id: str(uuid), workspace_id: str(uuid), description: str, max_nb_events: int, search_params: map{filters: any}, judge: map{id: str(uuid), created_at: str(date-time), updated_at: str(date-time), deleted_at: any, owner_id: str(uuid), workspace_id: str(uuid), name: str, description: str, model_name: str, output: any, instructions: str, tools: [str], up_revision: any, down_revision: any, base_revision: any}}
@errors {400, 404, 408, 409, 422}

@endpoint GET /v1/observability/campaigns
@optional {page_size: int=50, page: int=1, q: any}
@returns(200) {campaigns: map{results: [map], count: int, next: any, previous: any}}
@errors {400, 404, 408, 409, 422}

@endpoint GET /v1/observability/campaigns/{campaign_id}
@required {campaign_id: str(uuid)}
@returns(200) {id: str(uuid), created_at: str(date-time), updated_at: str(date-time), deleted_at: any, name: str, owner_id: str(uuid), workspace_id: str(uuid), description: str, max_nb_events: int, search_params: map{filters: any}, judge: map{id: str(uuid), created_at: str(date-time), updated_at: str(date-time), deleted_at: any, owner_id: str(uuid), workspace_id: str(uuid), name: str, description: str, model_name: str, output: any, instructions: str, tools: [str], up_revision: any, down_revision: any, base_revision: any}}
@errors {400, 404, 408, 409, 422}

@endpoint DELETE /v1/observability/campaigns/{campaign_id}
@required {campaign_id: str(uuid)}
@returns(204)
@errors {400, 404, 408, 409, 422}

@endpoint GET /v1/observability/campaigns/{campaign_id}/status
@required {campaign_id: str(uuid)}
@returns(200) {status: str}
@errors {400, 404, 408, 409, 422}

@endpoint GET /v1/observability/campaigns/{campaign_id}/selected-events
@required {campaign_id: str(uuid)}
@optional {page_size: int=50, page: int=1}
@returns(200) {completion_events: map{results: [map], count: int, next: any, previous: any}}
@errors {400, 404, 408, 409, 422}

@endpoint POST /v1/observability/datasets
@required {name: str, description: str}
@returns(201) {id: str(uuid), created_at: str(date-time), updated_at: str(date-time), deleted_at: any, name: str, description: str, owner_id: str(uuid), workspace_id: str(uuid)}
@errors {400, 404, 408, 409, 422}

@endpoint GET /v1/observability/datasets
@optional {page_size: int=50, page: int=1, q: any}
@returns(200) {datasets: map{results: [map], count: int, next: any, previous: any}}
@errors {400, 404, 408, 409, 422}

@endpoint GET /v1/observability/datasets/{dataset_id}
@required {dataset_id: str(uuid)}
@returns(200) {id: str(uuid), created_at: str(date-time), updated_at: str(date-time), deleted_at: any, name: str, description: str, owner_id: str(uuid), workspace_id: str(uuid)}
@errors {400, 404, 408, 409, 422}

@endpoint DELETE /v1/observability/datasets/{dataset_id}
@required {dataset_id: str(uuid)}
@returns(204)
@errors {400, 404, 408, 409, 422}

@endpoint PATCH /v1/observability/datasets/{dataset_id}
@required {dataset_id: str(uuid)}
@optional {name: any, description: any}
@returns(200) {id: str(uuid), created_at: str(date-time), updated_at: str(date-time), deleted_at: any, name: str, description: str, owner_id: str(uuid), workspace_id: str(uuid)}
@errors {400, 404, 408, 409, 422}

@endpoint GET /v1/observability/datasets/{dataset_id}/records
@required {dataset_id: str(uuid)}
@optional {page_size: int=50, page: int=1}
@returns(200) {records: map{results: [map], count: int, next: any, previous: any}}
@errors {400, 404, 408, 409, 422}

@endpoint POST /v1/observability/datasets/{dataset_id}/records
@required {dataset_id: str(uuid), payload: map{messages!: [map]}, properties: map}
@returns(201) {id: str(uuid), created_at: str(date-time), updated_at: str(date-time), deleted_at: any, dataset_id: str(uuid), payload: map{messages: [map]}, properties: map, source: str}
@errors {400, 404, 408, 409, 422}

@endpoint POST /v1/observability/datasets/{dataset_id}/imports/from-campaign
@required {dataset_id: str(uuid), campaign_id: str(uuid)}
@returns(202) {id: str(uuid), created_at: str(date-time), updated_at: str(date-time), deleted_at: any, creator_id: str(uuid), dataset_id: str(uuid), workspace_id: str(uuid), status: str, progress: any, message: any}
@errors {400, 404, 408, 409, 422}

@endpoint POST /v1/observability/datasets/{dataset_id}/imports/from-explorer
@required {dataset_id: str(uuid), completion_event_ids: [str]}
@returns(202) {id: str(uuid), created_at: str(date-time), updated_at: str(date-time), deleted_at: any, creator_id: str(uuid), dataset_id: str(uuid), workspace_id: str(uuid), status: str, progress: any, message: any}
@errors {400, 404, 408, 409, 422}

@endpoint POST /v1/observability/datasets/{dataset_id}/imports/from-file
@required {dataset_id: str(uuid), file_id: str}
@returns(202) {id: str(uuid), created_at: str(date-time), updated_at: str(date-time), deleted_at: any, creator_id: str(uuid), dataset_id: str(uuid), workspace_id: str(uuid), status: str, progress: any, message: any}
@errors {400, 404, 408, 409, 422}

@endpoint POST /v1/observability/datasets/{dataset_id}/imports/from-playground
@required {dataset_id: str(uuid), conversation_ids: [str]}
@returns(202) {id: str(uuid), created_at: str(date-time), updated_at: str(date-time), deleted_at: any, creator_id: str(uuid), dataset_id: str(uuid), workspace_id: str(uuid), status: str, progress: any, message: any}
@errors {400, 404, 408, 409, 422}

@endpoint POST /v1/observability/datasets/{dataset_id}/imports/from-dataset
@required {dataset_id: str(uuid), dataset_record_ids: [str(uuid)]}
@returns(202) {id: str(uuid), created_at: str(date-time), updated_at: str(date-time), deleted_at: any, creator_id: str(uuid), dataset_id: str(uuid), workspace_id: str(uuid), status: str, progress: any, message: any}
@errors {400, 404, 408, 409, 422}

@endpoint GET /v1/observability/datasets/{dataset_id}/exports/to-jsonl
@required {dataset_id: str(uuid)}
@returns(200) {file_url: str}
@errors {400, 404, 408, 409, 422}

@endpoint GET /v1/observability/datasets/{dataset_id}/tasks/{task_id}
@required {dataset_id: str(uuid), task_id: str(uuid)}
@returns(200) {id: str(uuid), created_at: str(date-time), updated_at: str(date-time), deleted_at: any, creator_id: str(uuid), dataset_id: str(uuid), workspace_id: str(uuid), status: str, progress: any, message: any}
@errors {400, 404, 408, 409, 422}

@endpoint GET /v1/observability/datasets/{dataset_id}/tasks
@required {dataset_id: str(uuid)}
@optional {page_size: int=50, page: int=1}
@returns(200) {tasks: map{results: [map], count: int, next: any, previous: any}}
@errors {400, 404, 408, 409, 422}

@endpoint GET /v1/observability/dataset-records/{dataset_record_id}
@required {dataset_record_id: str(uuid)}
@returns(200) {id: str(uuid), created_at: str(date-time), updated_at: str(date-time), deleted_at: any, dataset_id: str(uuid), payload: map{messages: [map]}, properties: map, source: str}
@errors {400, 404, 408, 409, 422}

@endpoint DELETE /v1/observability/dataset-records/{dataset_record_id}
@required {dataset_record_id: str(uuid)}
@returns(204)
@errors {400, 404, 408, 409, 422}

@endpoint POST /v1/observability/dataset-records/bulk-delete
@required {dataset_record_ids: [str(uuid)]}
@returns(204)
@errors {400, 404, 408, 409, 422}

@endpoint POST /v1/observability/dataset-records/{dataset_record_id}/live-judging
@required {dataset_record_id: str(uuid), judge_definition: map{name!: str, description!: str, model_name!: str, output!: any, instructions!: str, tools!: [str]}}
@returns(200) {analysis: str, answer: any}
@errors {400, 404, 408, 409, 422}

@endpoint PUT /v1/observability/dataset-records/{dataset_record_id}/payload
@required {dataset_record_id: str(uuid), payload: map{messages!: [map]}}
@returns(204)
@errors {400, 404, 408, 409, 422}

@endpoint PUT /v1/observability/dataset-records/{dataset_record_id}/properties
@required {dataset_record_id: str(uuid), properties: map}
@returns(204)
@errors {400, 404, 408, 409, 422}

@endgroup

@group workflows
@endpoint GET /v1/workflows/executions/{execution_id}
@required {execution_id: str}
@returns(200) {workflow_name: str, execution_id: str, parent_execution_id: any, root_execution_id: str, status: any, start_time: str(date-time), end_time: any, total_duration_ms: any, result: any}
@errors {422}

@endpoint GET /v1/workflows/executions/{execution_id}/history
@required {execution_id: str}
@optional {decode_payloads: bool=false}
@returns(200)
@errors {422}

@endpoint POST /v1/workflows/executions/{execution_id}/signals
@required {execution_id: str, name: str}
@optional {input: any}
@returns(202) {message: str}
@errors {422}

@endpoint POST /v1/workflows/executions/{execution_id}/queries
@required {execution_id: str, name: str}
@optional {input: any}
@returns(200) {query_name: str, result: any}
@errors {422}

@endpoint POST /v1/workflows/executions/{execution_id}/terminate
@required {execution_id: str}
@returns(204)
@errors {422}

@endpoint POST /v1/workflows/executions/terminate
@required {execution_ids: [str]}
@returns(200) {results: map}
@errors {422}

@endpoint POST /v1/workflows/executions/{execution_id}/cancel
@required {execution_id: str}
@returns(204)
@errors {422}

@endpoint POST /v1/workflows/executions/cancel
@required {execution_ids: [str]}
@returns(200) {results: map}
@errors {422}

@endpoint POST /v1/workflows/executions/{execution_id}/reset
@required {execution_id: str, event_id: int}
@optional {reason: any, exclude_signals: bool=false, exclude_updates: bool=false}
@returns(204)
@errors {422}

@endpoint POST /v1/workflows/executions/{execution_id}/updates
@required {execution_id: str, name: str}
@optional {input: any}
@returns(200) {update_name: str, result: any}
@errors {422}

@endpoint GET /v1/workflows/executions/{execution_id}/trace/otel
@required {execution_id: str}
@returns(200) {workflow_name: str, execution_id: str, parent_execution_id: any, root_execution_id: str, status: any, start_time: str(date-time), end_time: any, total_duration_ms: any, result: any, data_source: str, otel_trace_id: any, otel_trace_data: any}
@errors {422}

@endpoint GET /v1/workflows/executions/{execution_id}/trace/summary
@required {execution_id: str}
@returns(200) {workflow_name: str, execution_id: str, parent_execution_id: any, root_execution_id: str, status: any, start_time: str(date-time), end_time: any, total_duration_ms: any, result: any, span_tree: any}
@errors {422}

@endpoint GET /v1/workflows/executions/{execution_id}/trace/events
@required {execution_id: str}
@optional {merge_same_id_events: bool=false, include_internal_events: bool=false}
@returns(200) {workflow_name: str, execution_id: str, parent_execution_id: any, root_execution_id: str, status: any, start_time: str(date-time), end_time: any, total_duration_ms: any, result: any, events: [any]}
@errors {422}

@endpoint GET /v1/workflows/executions/{execution_id}/stream
@required {execution_id: str}
@optional {event_source: any, last_event_id: any}
@returns(200)
@errors {422}

@endpoint GET /v1/workflows/{workflow_name}/metrics
@required {workflow_name: str}
@optional {start_time: any, end_time: any}
@returns(200) {execution_count: map{value: any}, success_count: map{value: any}, error_count: map{value: any}, average_latency_ms: map{value: any}, latency_over_time: map{value: [[any]]}, retry_rate: map{value: any}}
@errors {422}

@endpoint GET /v1/workflows/runs
@optional {workflow_identifier: any, search: any, status: any, page_size: int=50, next_page_token: any}
@returns(200) {executions: [map], next_page_token: any}
@errors {422}

@endpoint GET /v1/workflows/runs/{run_id}
@required {run_id: str(uuid)}
@returns(200) {workflow_name: str, execution_id: str, parent_execution_id: any, root_execution_id: str, status: any, start_time: str(date-time), end_time: any, total_duration_ms: any, result: any}
@errors {422}

@endpoint GET /v1/workflows/runs/{run_id}/history
@required {run_id: str(uuid)}
@optional {decode_payloads: bool=false}
@returns(200)
@errors {422}

@endpoint GET /v1/workflows/schedules
@returns(200) {schedules: [map]}

@endpoint POST /v1/workflows/schedules
@required {schedule: map{input!: any, calendars: [map], intervals: [map], cron_expressions: [str], skip: [map], start_at: any, end_at: any, jitter: any, time_zone_name: any, policy: map, schedule_id: any}}
@optional {workflow_registration_id: any, workflow_version_id: any, workflow_identifier: any, workflow_task_queue: any, schedule_id: any, deployment_name: any}
@returns(201) {schedule_id: str}
@errors {422}

@endpoint DELETE /v1/workflows/schedules/{schedule_id}
@required {schedule_id: str}
@returns(204)
@errors {422}

@endpoint GET /v1/workflows/workers/whoami
@returns(200) {scheduler_url: str, namespace: str, tls: bool}

@endpoint GET /v1/workflows/events/stream
@optional {scope: str(activity/workflow/*)=*, activity_name: str=*, activity_id: str=*, workflow_name: str=*, workflow_exec_id: str=*, root_workflow_exec_id: str=*, parent_workflow_exec_id: str=*, stream: str=*, start_seq: int=0, metadata_filters: any, workflow_event_types: any, last-event-id: any}
@returns(200)
@errors {422}

@endpoint GET /v1/workflows/events/list
@optional {root_workflow_exec_id: any, workflow_exec_id: any, workflow_run_id: any, limit: int=100, cursor: any}
@returns(200) {events: [any], next_cursor: any}
@errors {422}

@endpoint GET /v1/workflows/deployments
@optional {active_only: bool=true, workflow_name: any}
@returns(200) {deployments: [map]}
@errors {422}

@endpoint GET /v1/workflows/deployments/{name}
@required {name: str}
@returns(200) {id: str(uuid), name: str, is_active: bool, created_at: str(date-time), updated_at: str(date-time), workers: [map]}
@errors {422}

@endpoint GET /v1/workflows/registrations
@optional {workflow_id: any, task_queue: any, active_only: bool=false, include_shared: bool=true, workflow_search: any, archived: any, with_workflow: bool=false, available_in_chat_assistant: any, limit: int=50, cursor: any}
@returns(200) {workflow_registrations: [map], next_cursor: any, workflow_versions: [map]}
@errors {422}

@endpoint POST /v1/workflows/{workflow_identifier}/execute
@required {workflow_identifier: str}
@optional {execution_id: any, input: any, encoded_input: any, wait_for_result: bool=false, timeout_seconds: any, custom_tracing_attributes: any, task_queue: any, deployment_name: any}
@returns(200)
@errors {422}

@endpoint POST /v1/workflows/registrations/{workflow_registration_id}/execute
@required {workflow_registration_id: str(uuid)}
@optional {execution_id: any, input: any, encoded_input: any, wait_for_result: bool=false, timeout_seconds: any, custom_tracing_attributes: any, task_queue: any, deployment_name: any}
@returns(200)
@errors {422}

@endpoint GET /v1/workflows/{workflow_identifier}
@required {workflow_identifier: str}
@returns(200) {workflow: map{id: str(uuid), name: str, display_name: str, type: str, description: any, customer_id: str(uuid), workspace_id: str(uuid), shared_namespace: any, available_in_chat_assistant: bool, is_technical: bool, archived: bool, active: bool}}
@errors {422}

@endpoint PUT /v1/workflows/{workflow_identifier}
@required {workflow_identifier: str}
@optional {display_name: any, description: any, available_in_chat_assistant: any}
@returns(200) {workflow: map{id: str(uuid), name: str, display_name: str, type: str, description: any, customer_id: str(uuid), workspace_id: str(uuid), shared_namespace: any, available_in_chat_assistant: bool, is_technical: bool, archived: bool}}
@errors {422}

@endpoint GET /v1/workflows/registrations/{workflow_registration_id}
@required {workflow_registration_id: str(uuid)}
@optional {with_workflow: bool=false, include_shared: bool=true}
@returns(200) {workflow_registration: map{id: str(uuid), task_queue: str, definition: map{input_schema: map, output_schema: any, signals: [map], queries: [map], updates: [map], enforce_determinism: bool, execution_timeout: num}, workflow_id: str(uuid), workflow: any, compatible_with_chat_assistant: bool, active: bool}, workflow_version: map{id: str(uuid), task_queue: str, definition: map{input_schema: map, output_schema: any, signals: [map], queries: [map], updates: [map], enforce_determinism: bool, execution_timeout: num}, workflow_id: str(uuid), workflow: any, compatible_with_chat_assistant: bool, active: bool}}
@errors {422}

@endpoint PUT /v1/workflows/{workflow_identifier}/archive
@required {workflow_identifier: str}
@returns(200) {workflow: map{id: str(uuid), name: str, display_name: str, type: str, description: any, customer_id: str(uuid), workspace_id: str(uuid), shared_namespace: any, available_in_chat_assistant: bool, is_technical: bool, archived: bool}}
@errors {422}

@endpoint PUT /v1/workflows/{workflow_identifier}/unarchive
@required {workflow_identifier: str}
@returns(200) {workflow: map{id: str(uuid), name: str, display_name: str, type: str, description: any, customer_id: str(uuid), workspace_id: str(uuid), shared_namespace: any, available_in_chat_assistant: bool, is_technical: bool, archived: bool}}
@errors {422}

@endgroup

@end
