> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crewship.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# API Reference

> Crewship REST API for programmatic access

## Overview

The Crewship API allows you to programmatically:

* Trigger and monitor runs
* Stream real-time events
* Manage threads for stateful conversations
* Store and query structured data tables

## Base URL

```
https://api.crewship.dev
```

## Authentication

All API requests require authentication using an API key:

```bash theme={null}
curl https://api.crewship.dev/v1/runs \
  -H "Authorization: Bearer YOUR_API_KEY"
```

### Getting an API Key

1. Open the [Crewship Console](https://console.crewship.dev)
2. Go to **Settings** → **API Keys**
3. Click **Create API Key**
4. Copy and store the key securely

<Warning>
  API keys are shown only once. Store them securely and never commit them to version control.
</Warning>

## Request Format

### Headers

| Header          | Required     | Description           |
| --------------- | ------------ | --------------------- |
| `Authorization` | Yes          | `Bearer YOUR_API_KEY` |
| `Content-Type`  | For POST/PUT | `application/json`    |

### Request Body

POST requests accept JSON:

```bash theme={null}
curl -X POST https://api.crewship.dev/v1/runs \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "deployment_id": "dep_abc123xyz",
    "input": {"topic": "AI agents"}
  }'
```

## Response Format

### Success Responses

Responses return JSON objects directly:

```json theme={null}
{
  "run_id": "run_abc123",
  "version_id": "ver_xyz789",
  "version_number": 3,
  "status": "running"
}
```

### List Responses

List endpoints return arrays under a named key:

```json theme={null}
{
  "runs": [
    { "id": "run_abc123", "status": "succeeded", ... },
    { "id": "run_xyz789", "status": "running", ... }
  ]
}
```

### Error Responses

```json theme={null}
{
  "error": {
    "message": "deployment_id is required"
  }
}
```

## HTTP Status Codes

| Code  | Description                      |
| ----- | -------------------------------- |
| `200` | Success                          |
| `201` | Created                          |
| `202` | Accepted (async operation)       |
| `400` | Bad request (invalid parameters) |
| `401` | Unauthorized (invalid API key)   |
| `404` | Not found                        |
| `409` | Conflict (e.g., thread is busy)  |
| `503` | Service unavailable              |

## SDKs

<CardGroup cols={3}>
  <Card title="TypeScript" icon="js">
    Coming soon
  </Card>

  <Card title="Python" icon="python">
    Coming soon
  </Card>

  <Card title="Go" icon="golang">
    Coming soon
  </Card>
</CardGroup>

## API Endpoints

<CardGroup cols={3}>
  <Card title="Runs" icon="play" href="/api-reference/runs/create">
    Trigger and monitor runs
  </Card>

  <Card title="Threads" icon="comments" href="/api-reference/threads/create">
    Stateful conversation threads
  </Card>

  <Card title="Tables" icon="table" href="/api-reference/tables/list">
    Structured table storage and row operations
  </Card>
</CardGroup>
