POST
/
api
/
project
/
{projectId}
/
integration
/
api
/
chat
/
completions
curl --request POST \
  --url https://app.pathors.com/api/project/{projectId}/integration/api/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "messages": [
    {}
  ],
  "stream": true,
  "session_id": "<string>"
}'
{
  "id": "<string>",
  "object": "<string>",
  "created": 123,
  "model": "<string>",
  "choices": [
    {}
  ],
  "session_id": "<string>"
}

API Integration

The API integration provides an OpenAI-compatible chat completions endpoint that you can use to interact with your Pathors project.

Chat Completions

POST /api/project/{projectId}/integration/api/chat/completions

Path Parameters

projectId
string
required

The ID of your project

Request Headers

Authorization
string
required

Bearer token authentication using your API key

Request Body

messages
array
required

Array of messages in the conversation. Each message should have a role (“system”, “user”, or “assistant”) and content.

stream
boolean

Whether to stream the response. Defaults to false.

session_id
string

Optional session ID for conversation continuity.

Example request:

{
  "messages": [
    {
      "role": "user",
      "content": "Hello!"
    }
  ],
  "stream": false
}

Response

id
string

Unique identifier for the completion

object
string

Object type (“chat.completion”)

created
number

Unix timestamp of when the completion was created

model
string

Model used for the completion

choices
array

Array of completion choices

session_id
string

Session ID for the conversation

Example response:

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1677858242,
  "model": "pathway-default",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hi! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": -1,
    "completion_tokens": -1,
    "total_tokens": -1
  },
  "session_id": "session-xyz789"
}

Streaming Response

When stream is set to true, the response will be a stream of server-sent events (SSE). Each event contains a chunk of the response in the following format:

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion.chunk",
  "created": 1677858242,
  "model": "pathway-default",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": "Hi"
      },
      "finish_reason": null
    }
  ],
  "session_id": "session-xyz789"
}

The final chunk will have finish_reason: "stop" and will be followed by data: [DONE].

Error Responses

Status CodeDescription
400Invalid request body
401Invalid authentication
500Internal server error

Setup Guide

  1. Enable the API integration in your Pathors project settings
  2. Generate an API key in your project’s integration settings
  3. Use the API key in the Authorization header for your requests