POST
/
api
/
project
/
{projectId}
/
integration
/
api
/
v1
/
threads
/
{thread_id}
/
runs
curl --request POST \
  --url https://app.pathors.com/api/project/{projectId}/integration/api/v1/threads/{thread_id}/runs

Assistants API

Pathors provides OpenAI-compatible Assistants API endpoints for building assistant experiences. This interface follows a subset of the OpenAI Assistants API specification.

Supported Features

Currently, the Assistants API supports the following operations:

  • Retrieving assistants (your project acts as the assistant)
  • Creating threads
  • Adding messages to threads
  • Running assistants on threads
  • Creating threads and running assistants in one call

Note: Some OpenAI Assistants API features are not yet supported, including streaming responses and structured tool outputs.

Base URL

/api/project/{projectId}/integration/api

Authentication

All Assistants API requests require authentication using an API key.

Authorization: Bearer {your-api-key}

Available Endpoints

Assistants

MethodEndpointDescription
GET/v1/assistants/{assistant_id}Retrieve an assistant
GET/v1/assistantsList assistants

Threads

MethodEndpointDescription
POST/v1/threadsCreate a thread
GET/v1/threads/{thread_id}Retrieve a thread

Messages

MethodEndpointDescription
POST/v1/threads/{thread_id}/messagesCreate a message
GET/v1/threads/{thread_id}/messagesList messages
GET/v1/threads/{thread_id}/messages/{message_id}Retrieve a message

Runs

MethodEndpointDescription
POST/v1/threads/{thread_id}/runsCreate a run
GET/v1/threads/{thread_id}/runs/{run_id}Retrieve a run
POST/v1/threads/runsCreate a thread and run in one operation

Example Usage

Basic Conversational Flow

from openai import OpenAI

# Initialize client with Pathors API URL
client = OpenAI(
    api_key="your-api-key",
    base_url="https://app.pathors.com/api/project/your-project-id/integration/api"
)

# Get an assistant (using project ID as assistant ID)
assistant = client.beta.assistants.retrieve(assistant_id="your-project-id")

# Create a thread and run in one step (recommended approach)
run = client.beta.threads.create_and_run(
    assistant_id="your-project-id",
    thread={
        "messages": [
            {
                "role": "user",
                "content": "Hello, can you help me with a question?"
            }
        ]
    }
)

# Poll for completion
while run.status in ["queued", "in_progress"]:
    time.sleep(1)
    run = client.beta.threads.runs.retrieve(
        thread_id=run.thread_id,
        run_id=run.id
    )
    print(f"Run status: {run.status}")

# List messages after completion
messages = client.beta.threads.messages.list(thread_id=run.thread_id)
for msg in messages.data:
    print(f"[{msg.role}]: {msg.content[0].text.value}")

# Continue the conversation
client.beta.threads.messages.create(
    thread_id=run.thread_id,
    role="user",
    content="Tell me more about this topic."
)

# Run the assistant again on the same thread
new_run = client.beta.threads.runs.create(
    thread_id=run.thread_id,
    assistant_id="your-project-id"
)

# Poll for completion
while new_run.status in ["queued", "in_progress"]:
    time.sleep(1)
    new_run = client.beta.threads.runs.retrieve(
        thread_id=run.thread_id,
        run_id=new_run.id
    )

# Get the latest messages
updated_messages = client.beta.threads.messages.list(
    thread_id=run.thread_id,
    order="desc",
    limit=1
)
print(f"[{updated_messages.data[0].role}]: {updated_messages.data[0].content[0].text.value}")

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