@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api Anthropic API + fast-mode
@base https://api.anthropic.com
@version 253
@auth ApiKey x-api-key in header
@common_fields {anthropic-version: str}
@endpoints 47
@hint download_for_search
@toc messages(15), complete(1), models(3), files(8), skills(14), messages?beta=true(1), models?beta=true(1), files?beta=true(2), skills?beta=true(2)

@group messages
@endpoint POST /v1/messages
@required {model: any, messages: [map{content!: any, role!: str}], max_tokens: int}
@optional {inference_geo: any, metadata: map{user_id: any}, output_config: map{effort: any, format: any}, service_tier: str(auto/standard_only), stop_sequences: [str], stream: bool, system: any, temperature: num, thinking: any, tool_choice: any, tools: [any], top_k: int, top_p: num}
@returns(200) {id: str, type: str, role: str, content: [any], model: any, stop_reason: any, stop_sequence: any, usage: map{cache_creation: any, cache_creation_input_tokens: any, cache_read_input_tokens: any, inference_geo: any, input_tokens: int, output_tokens: int, server_tool_use: any, service_tier: any}}
@errors {4XX}

@endgroup

@group complete
@endpoint POST /v1/complete
@required {model: any, prompt: str, max_tokens_to_sample: int}
@optional {anthropic-beta: str, stop_sequences: [str], temperature: num, top_p: num, top_k: int, metadata: map{user_id: any}, stream: bool}
@returns(200) {completion: str, id: str, model: any, stop_reason: any, type: str}
@errors {4XX}

@endgroup

@group models
@endpoint GET /v1/models
@optional {before_id: str, after_id: str, limit: int=20, x-api-key: str, anthropic-beta: str}
@returns(200) {data: [map], first_id: any, has_more: bool, last_id: any}
@errors {4XX}

@endpoint GET /v1/models/{model_id}
@required {model_id: str}
@optional {x-api-key: str, anthropic-beta: str}
@returns(200) {created_at: str(date-time), display_name: str, id: str, type: str}
@errors {4XX}

@endgroup

@group messages
@endpoint POST /v1/messages/batches
@required {requests: [map{custom_id!: str, params!: map}]}
@returns(200) {archived_at: any, cancel_initiated_at: any, created_at: str(date-time), ended_at: any, expires_at: str(date-time), id: str, processing_status: str, request_counts: map{canceled: int, errored: int, expired: int, processing: int, succeeded: int}, results_url: any, type: str}
@errors {4XX}

@endpoint GET /v1/messages/batches
@optional {before_id: str, after_id: str, limit: int=20, x-api-key: str}
@returns(200) {data: [map], first_id: any, has_more: bool, last_id: any}
@errors {4XX}

@endpoint GET /v1/messages/batches/{message_batch_id}
@required {message_batch_id: str}
@optional {x-api-key: str}
@returns(200) {archived_at: any, cancel_initiated_at: any, created_at: str(date-time), ended_at: any, expires_at: str(date-time), id: str, processing_status: str, request_counts: map{canceled: int, errored: int, expired: int, processing: int, succeeded: int}, results_url: any, type: str}
@errors {4XX}

@endpoint DELETE /v1/messages/batches/{message_batch_id}
@required {message_batch_id: str}
@optional {x-api-key: str}
@returns(200) {id: str, type: str}
@errors {4XX}

@endpoint POST /v1/messages/batches/{message_batch_id}/cancel
@required {message_batch_id: str}
@returns(200) {archived_at: any, cancel_initiated_at: any, created_at: str(date-time), ended_at: any, expires_at: str(date-time), id: str, processing_status: str, request_counts: map{canceled: int, errored: int, expired: int, processing: int, succeeded: int}, results_url: any, type: str}
@errors {4XX}

@endpoint GET /v1/messages/batches/{message_batch_id}/results
@required {message_batch_id: str}
@optional {x-api-key: str}
@returns(200)
@errors {4XX}

@endpoint POST /v1/messages/count_tokens
@required {messages: [map{content!: any, role!: str}], model: any}
@optional {output_config: map{effort: any, format: any}, system: any, thinking: any, tool_choice: any, tools: [any]}
@returns(200) {input_tokens: int}
@errors {4XX}

@endgroup

@group files
@endpoint POST /v1/files
@optional {anthropic-beta: str}
@returns(200) {created_at: str(date-time), downloadable: bool, filename: str, id: str, mime_type: str, size_bytes: int, type: str}
@errors {4XX}

@endpoint GET /v1/files
@optional {before_id: str, after_id: str, limit: int=20, anthropic-beta: str, x-api-key: str}
@returns(200) {data: [map], first_id: any, has_more: bool, last_id: any}
@errors {4XX}

@endpoint GET /v1/files/{file_id}
@required {file_id: str}
@optional {anthropic-beta: str, x-api-key: str}
@returns(200) {created_at: str(date-time), downloadable: bool, filename: str, id: str, mime_type: str, size_bytes: int, type: str}
@errors {4XX}

@endpoint DELETE /v1/files/{file_id}
@required {file_id: str}
@optional {anthropic-beta: str, x-api-key: str}
@returns(200) {id: str, type: str}
@errors {4XX}

@endpoint GET /v1/files/{file_id}/content
@required {file_id: str}
@optional {anthropic-beta: str, x-api-key: str}
@returns(200)
@errors {4XX}

@endgroup

@group skills
@endpoint POST /v1/skills
@optional {anthropic-beta: str}
@returns(200) {created_at: str, display_title: any, id: str, latest_version: any, source: str, type: str, updated_at: str}
@errors {4XX}

@endpoint GET /v1/skills
@optional {page: any, limit: int=20, source: any, anthropic-beta: str, x-api-key: str}
@returns(200) {data: [map], has_more: bool, next_page: any}
@errors {4XX}

@endpoint GET /v1/skills/{skill_id}
@required {skill_id: str}
@optional {anthropic-beta: str, x-api-key: str}
@returns(200) {created_at: str, display_title: any, id: str, latest_version: any, source: str, type: str, updated_at: str}
@errors {4XX}

@endpoint DELETE /v1/skills/{skill_id}
@required {skill_id: str}
@optional {anthropic-beta: str, x-api-key: str}
@returns(200) {id: str, type: str}
@errors {4XX}

@endpoint POST /v1/skills/{skill_id}/versions
@required {skill_id: str}
@optional {anthropic-beta: str}
@returns(200) {created_at: str, description: str, directory: str, id: str, name: str, skill_id: str, type: str, version: str}
@errors {4XX}

@endpoint GET /v1/skills/{skill_id}/versions
@required {skill_id: str}
@optional {page: any, limit: any, anthropic-beta: str, x-api-key: str}
@returns(200) {data: [map], has_more: bool, next_page: any}
@errors {4XX}

@endpoint GET /v1/skills/{skill_id}/versions/{version}
@required {skill_id: str, version: str}
@optional {anthropic-beta: str, x-api-key: str}
@returns(200) {created_at: str, description: str, directory: str, id: str, name: str, skill_id: str, type: str, version: str}
@errors {4XX}

@endpoint DELETE /v1/skills/{skill_id}/versions/{version}
@required {skill_id: str, version: str}
@optional {anthropic-beta: str, x-api-key: str}
@returns(200) {id: str, type: str}
@errors {4XX}

@endgroup

@group messages?beta=true
@endpoint POST /v1/messages?beta=true
@required {model: any, messages: [map{content!: any, role!: str}], max_tokens: int}
@optional {anthropic-beta: str, container: any, context_management: any, inference_geo: any, mcp_servers: [map{authorization_token: any, name!: str, tool_configuration: any, type!: str, url!: str}], metadata: map{user_id: any}, output_config: map{effort: any, format: any}, output_format: any, service_tier: str(auto/standard_only), speed: any, stop_sequences: [str], stream: bool, system: any, temperature: num, thinking: any, tool_choice: any, tools: [any], top_k: int, top_p: num}
@returns(200) {id: str, type: str, role: str, content: [any], model: any, stop_reason: any, stop_sequence: any, usage: map{cache_creation: any, cache_creation_input_tokens: any, cache_read_input_tokens: any, inference_geo: any, input_tokens: int, iterations: any, output_tokens: int, server_tool_use: any, service_tier: any, speed: any}, context_management: any, container: any}
@errors {4XX}

@endgroup

@group models?beta=true
@endpoint GET /v1/models?beta=true
@optional {before_id: str, after_id: str, limit: int=20, x-api-key: str, anthropic-beta: str}
@returns(200) {data: [map], first_id: any, has_more: bool, last_id: any}
@errors {4XX}

@endgroup

@group models
@endpoint GET /v1/models/{model_id}?beta=true
@required {model_id: str}
@optional {x-api-key: str, anthropic-beta: str}
@returns(200) {created_at: str(date-time), display_name: str, id: str, type: str}
@errors {4XX}

@endgroup

@group messages
@endpoint POST /v1/messages/batches?beta=true
@required {requests: [map{custom_id!: str, params!: map}]}
@optional {anthropic-beta: str}
@returns(200) {archived_at: any, cancel_initiated_at: any, created_at: str(date-time), ended_at: any, expires_at: str(date-time), id: str, processing_status: str, request_counts: map{canceled: int, errored: int, expired: int, processing: int, succeeded: int}, results_url: any, type: str}
@errors {4XX}

@endpoint GET /v1/messages/batches?beta=true
@optional {before_id: str, after_id: str, limit: int=20, anthropic-beta: str, x-api-key: str}
@returns(200) {data: [map], first_id: any, has_more: bool, last_id: any}
@errors {4XX}

@endpoint GET /v1/messages/batches/{message_batch_id}?beta=true
@required {message_batch_id: str}
@optional {anthropic-beta: str, x-api-key: str}
@returns(200) {archived_at: any, cancel_initiated_at: any, created_at: str(date-time), ended_at: any, expires_at: str(date-time), id: str, processing_status: str, request_counts: map{canceled: int, errored: int, expired: int, processing: int, succeeded: int}, results_url: any, type: str}
@errors {4XX}

@endpoint DELETE /v1/messages/batches/{message_batch_id}?beta=true
@required {message_batch_id: str}
@optional {anthropic-beta: str, x-api-key: str}
@returns(200) {id: str, type: str}
@errors {4XX}

@endpoint POST /v1/messages/batches/{message_batch_id}/cancel?beta=true
@required {message_batch_id: str}
@optional {anthropic-beta: str}
@returns(200) {archived_at: any, cancel_initiated_at: any, created_at: str(date-time), ended_at: any, expires_at: str(date-time), id: str, processing_status: str, request_counts: map{canceled: int, errored: int, expired: int, processing: int, succeeded: int}, results_url: any, type: str}
@errors {4XX}

@endpoint GET /v1/messages/batches/{message_batch_id}/results?beta=true
@required {message_batch_id: str}
@optional {anthropic-beta: str, x-api-key: str}
@returns(200)
@errors {4XX}

@endpoint POST /v1/messages/count_tokens?beta=true
@required {messages: [map{content!: any, role!: str}], model: any}
@optional {anthropic-beta: str, context_management: any, mcp_servers: [map{authorization_token: any, name!: str, tool_configuration: any, type!: str, url!: str}], output_config: map{effort: any, format: any}, output_format: any, speed: any, system: any, thinking: any, tool_choice: any, tools: [any]}
@returns(200) {context_management: any, input_tokens: int}
@errors {4XX}

@endgroup

@group files?beta=true
@endpoint POST /v1/files?beta=true
@optional {anthropic-beta: str}
@returns(200) {created_at: str(date-time), downloadable: bool, filename: str, id: str, mime_type: str, size_bytes: int, type: str}
@errors {4XX}

@endpoint GET /v1/files?beta=true
@optional {before_id: str, after_id: str, limit: int=20, anthropic-beta: str, x-api-key: str}
@returns(200) {data: [map], first_id: any, has_more: bool, last_id: any}
@errors {4XX}

@endgroup

@group files
@endpoint GET /v1/files/{file_id}?beta=true
@required {file_id: str}
@optional {anthropic-beta: str, x-api-key: str}
@returns(200) {created_at: str(date-time), downloadable: bool, filename: str, id: str, mime_type: str, size_bytes: int, type: str}
@errors {4XX}

@endpoint DELETE /v1/files/{file_id}?beta=true
@required {file_id: str}
@optional {anthropic-beta: str, x-api-key: str}
@returns(200) {id: str, type: str}
@errors {4XX}

@endpoint GET /v1/files/{file_id}/content?beta=true
@required {file_id: str}
@optional {anthropic-beta: str, x-api-key: str}
@returns(200)
@errors {4XX}

@endgroup

@group skills?beta=true
@endpoint POST /v1/skills?beta=true
@optional {anthropic-beta: str}
@returns(200) {created_at: str, display_title: any, id: str, latest_version: any, source: str, type: str, updated_at: str}
@errors {4XX}

@endpoint GET /v1/skills?beta=true
@optional {page: any, limit: int=20, source: any, anthropic-beta: str, x-api-key: str}
@returns(200) {data: [map], has_more: bool, next_page: any}
@errors {4XX}

@endgroup

@group skills
@endpoint GET /v1/skills/{skill_id}?beta=true
@required {skill_id: str}
@optional {anthropic-beta: str, x-api-key: str}
@returns(200) {created_at: str, display_title: any, id: str, latest_version: any, source: str, type: str, updated_at: str}
@errors {4XX}

@endpoint DELETE /v1/skills/{skill_id}?beta=true
@required {skill_id: str}
@optional {anthropic-beta: str, x-api-key: str}
@returns(200) {id: str, type: str}
@errors {4XX}

@endpoint POST /v1/skills/{skill_id}/versions?beta=true
@required {skill_id: str}
@optional {anthropic-beta: str}
@returns(200) {created_at: str, description: str, directory: str, id: str, name: str, skill_id: str, type: str, version: str}
@errors {4XX}

@endpoint GET /v1/skills/{skill_id}/versions?beta=true
@required {skill_id: str}
@optional {page: any, limit: any, anthropic-beta: str, x-api-key: str}
@returns(200) {data: [map], has_more: bool, next_page: any}
@errors {4XX}

@endpoint GET /v1/skills/{skill_id}/versions/{version}?beta=true
@required {skill_id: str, version: str}
@optional {anthropic-beta: str, x-api-key: str}
@returns(200) {created_at: str, description: str, directory: str, id: str, name: str, skill_id: str, type: str, version: str}
@errors {4XX}

@endpoint DELETE /v1/skills/{skill_id}/versions/{version}?beta=true
@required {skill_id: str, version: str}
@optional {anthropic-beta: str, x-api-key: str}
@returns(200) {id: str, type: str}
@errors {4XX}

@endgroup

@end
