NinjaChat Sessions API
The Sessions API from NinjaChat — 3 operation(s) for sessions.
The Sessions API from NinjaChat — 3 operation(s) for sessions.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/ninjachat-ai:ninjachat-ai-sessions-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: NinjaChat Sessions API
version: 1.0.0
description: Clean-break NinjaChat v1. Chat and Responses bill actual token usage; images and videos use catalog unit pricing.
servers:
- url: https://www.ninjachat.ai/api/v1
tags:
- name: Sessions
paths:
/sessions:
post:
summary: Create a chat session
security:
- bearerAuth: []
requestBody:
content:
application/json:
schema:
type: object
properties: {}
responses:
'200':
description: Created or existing session.
content:
application/json:
schema:
type: object
properties: {}
'400':
description: Invalid or unsupported request parameter.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'402':
description: Insufficient balance or project spend limit reached.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'429':
description: Rate limit exceeded.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Gateway error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
x-ninjachat-status: supported_legacy
x-ninjachat-replacement: client-side message history on POST /responses
description: 'Supported compatibility surface — kept working indefinitely, but not the path for new integrations. Modern equivalent: `client-side message history on POST /responses`.'
tags:
- Sessions
operationId: postSessions
x-operation-id-source: derived
/sessions/{id}:
get:
summary: Get a chat session
security:
- bearerAuth: []
parameters:
- schema:
type: string
required: true
name: id
in: path
responses:
'200':
description: Session messages and metadata.
content:
application/json:
schema:
type: object
properties: {}
'400':
description: Invalid or unsupported request parameter.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'402':
description: Insufficient balance or project spend limit reached.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Session not found.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'429':
description: Rate limit exceeded.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Gateway error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
x-ninjachat-status: supported_legacy
x-ninjachat-replacement: client-side message history on POST /responses
description: 'Supported compatibility surface — kept working indefinitely, but not the path for new integrations. Modern equivalent: `client-side message history on POST /responses`.'
tags:
- Sessions
operationId: getSessionsById
x-operation-id-source: derived
delete:
summary: Delete a chat session
security:
- bearerAuth: []
parameters:
- schema:
type: string
required: true
name: id
in: path
responses:
'200':
description: Session deleted.
content:
application/json:
schema:
type: object
properties: {}
'400':
description: Invalid or unsupported request parameter.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'402':
description: Insufficient balance or project spend limit reached.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Session not found.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'429':
description: Rate limit exceeded.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Gateway error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
x-ninjachat-status: supported_legacy
x-ninjachat-replacement: client-side message history on POST /responses
description: 'Supported compatibility surface — kept working indefinitely, but not the path for new integrations. Modern equivalent: `client-side message history on POST /responses`.'
tags:
- Sessions
operationId: deleteSessionsById
x-operation-id-source: derived
/sessions/{id}/export:
get:
summary: Export a chat session
security:
- bearerAuth: []
parameters:
- schema:
type: string
required: true
name: id
in: path
- schema:
type: string
enum:
- json
- markdown
required: false
name: format
in: query
responses:
'200':
description: JSON or Markdown session export.
'400':
description: Invalid or unsupported request parameter.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'402':
description: Insufficient balance or project spend limit reached.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Session not found.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'429':
description: Rate limit exceeded.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Gateway error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
x-ninjachat-status: supported_legacy
x-ninjachat-replacement: client-side message history on POST /responses
description: 'Supported compatibility surface — kept working indefinitely, but not the path for new integrations. Modern equivalent: `client-side message history on POST /responses`.'
tags:
- Sessions
operationId: getSessionsByIdExport
x-operation-id-source: derived
components:
schemas:
ErrorResponse:
type: object
properties:
error:
type: object
properties:
message:
type: string
type:
type: string
code:
type: string
param:
type:
- string
- 'null'
required:
- message
- type
- code
additionalProperties: false
required:
- error
additionalProperties: false
securitySchemes:
managementKey:
type: http
scheme: bearer
bearerFormat: nj_mk_...
description: Account-scoped management credential created by the account owner after email verification. Inference keys cannot access these endpoints; management keys cannot run inference.
anthropicApiKey:
type: apiKey
in: header
name: x-api-key
description: NinjaChat API key accepted by the Anthropic Messages compatibility endpoint.
bearerAuth:
type: http
scheme: bearer
bearerFormat: NinjaChat API key
description: Use an API key created in the NinjaChat developer console.
x-ninjachat-contract-sha256: df530775ec7be5779917a6c4c5b6015b760809e62fd002827541bf6cac66310e