Hadrian is experimental alpha software. Do not use in production.
Hadrian

Conversations

Store and manage chat conversation history. Conversations can be owned by users or projects and support multiple models.

Create a new conversation

POST
/admin/v1/conversations
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Request Body

application/json

messages?

Initial messages (optional)

models?array<string>

Models used in this conversation

owner*|

Owner of the conversation

title*string

Title of the conversation

Response Body

application/json

application/json

curl -X POST "https://loading/admin/v1/conversations" \  -H "Content-Type: application/json" \  -d '{    "owner": {      "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",      "type": "project"    },    "title": "string"  }'
{
  "created_at": "2019-08-24T14:15:22Z",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "messages": [
    {
      "content": "string",
      "role": "string"
    }
  ],
  "models": [
    "string"
  ],
  "owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
  "owner_type": "project",
  "pin_order": 0,
  "title": "string",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "error": {
    "code": "budget_exceeded",
    "message": "Budget limit exceeded for monthly period",
    "param": null,
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "invalid_request_error"
  }
}

Get a conversation by ID

GET
/admin/v1/conversations/{id}
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Path Parameters

id*string

Conversation ID

Formatuuid

Response Body

application/json

application/json

curl -X GET "https://loading/admin/v1/conversations/497f6eca-6276-4993-bfeb-53cbbbba6f08"
{
  "created_at": "2019-08-24T14:15:22Z",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "messages": [
    {
      "content": "string",
      "role": "string"
    }
  ],
  "models": [
    "string"
  ],
  "owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
  "owner_type": "project",
  "pin_order": 0,
  "title": "string",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "error": {
    "code": "budget_exceeded",
    "message": "Budget limit exceeded for monthly period",
    "param": null,
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "invalid_request_error"
  }
}

Update a conversation

PATCH
/admin/v1/conversations/{id}
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Path Parameters

id*string

Conversation ID

Formatuuid

Request Body

application/json

messages?|null

Replace all messages

models?|null

New models list

owner?null|
title?string|null

New title

Response Body

application/json

application/json

curl -X PATCH "https://loading/admin/v1/conversations/497f6eca-6276-4993-bfeb-53cbbbba6f08" \  -H "Content-Type: application/json" \  -d '{}'
{
  "created_at": "2019-08-24T14:15:22Z",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "messages": [
    {
      "content": "string",
      "role": "string"
    }
  ],
  "models": [
    "string"
  ],
  "owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
  "owner_type": "project",
  "pin_order": 0,
  "title": "string",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "error": {
    "code": "budget_exceeded",
    "message": "Budget limit exceeded for monthly period",
    "param": null,
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "invalid_request_error"
  }
}

Delete a conversation

DELETE
/admin/v1/conversations/{id}
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Path Parameters

id*string

Conversation ID

Formatuuid

Response Body

application/json

curl -X DELETE "https://loading/admin/v1/conversations/497f6eca-6276-4993-bfeb-53cbbbba6f08"
Empty
{
  "error": {
    "code": "budget_exceeded",
    "message": "Budget limit exceeded for monthly period",
    "param": null,
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "invalid_request_error"
  }
}

Append messages to a conversation

POST
/admin/v1/conversations/{id}/messages
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Path Parameters

id*string

Conversation ID

Formatuuid

Request Body

application/json

messages*

Response Body

application/json

application/json

curl -X POST "https://loading/admin/v1/conversations/497f6eca-6276-4993-bfeb-53cbbbba6f08/messages" \  -H "Content-Type: application/json" \  -d '{    "messages": [      {        "content": "string",        "role": "string"      }    ]  }'
[
  {
    "content": "string",
    "role": "string"
  }
]
{
  "error": {
    "code": "budget_exceeded",
    "message": "Budget limit exceeded for monthly period",
    "param": null,
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "invalid_request_error"
  }
}

Set pin order for a conversation

PUT
/admin/v1/conversations/{id}/pin
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Path Parameters

id*string

Conversation ID

Formatuuid

Request Body

application/json

pin_order?integer|null

The pin order (0 = first, higher = lower in list). Set to null to unpin.

Formatint32

Response Body

application/json

application/json

curl -X PUT "https://loading/admin/v1/conversations/497f6eca-6276-4993-bfeb-53cbbbba6f08/pin" \  -H "Content-Type: application/json" \  -d '{}'
{
  "created_at": "2019-08-24T14:15:22Z",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "messages": [
    {
      "content": "string",
      "role": "string"
    }
  ],
  "models": [
    "string"
  ],
  "owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
  "owner_type": "project",
  "pin_order": 0,
  "title": "string",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "error": {
    "code": "budget_exceeded",
    "message": "Budget limit exceeded for monthly period",
    "param": null,
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "invalid_request_error"
  }
}

List conversations by project

GET
/admin/v1/organizations/{org_slug}/projects/{project_slug}/conversations
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Path Parameters

org_slug*string

Organization slug

project_slug*string

Project slug

Query Parameters

limit?integer|null

Maximum number of results to return

Formatint64
cursor?string|null

Cursor for keyset pagination. Encoded as base64 string.

direction?string|null

Pagination direction: "forward" (default) or "backward".

include_deleted?boolean|null

Include soft-deleted records in results

Response Body

application/json

application/json

application/json

curl -X GET "https://loading/admin/v1/organizations/string/projects/string/conversations"
{
  "data": [
    {
      "created_at": "2019-08-24T14:15:22Z",
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "messages": [
        {
          "content": "string",
          "role": "string"
        }
      ],
      "models": [
        "string"
      ],
      "owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
      "owner_type": "project",
      "pin_order": 0,
      "title": "string",
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ],
  "pagination": {
    "has_more": true,
    "limit": 100,
    "next_cursor": "MTczMzU4MDgwMDAwMDphYmMxMjM0NS02Nzg5LTAxMjMtNDU2Ny0wMTIzNDU2Nzg5YWI",
    "prev_cursor": "string"
  }
}
{
  "error": {
    "code": "budget_exceeded",
    "message": "Budget limit exceeded for monthly period",
    "param": null,
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "invalid_request_error"
  }
}
{
  "error": {
    "code": "budget_exceeded",
    "message": "Budget limit exceeded for monthly period",
    "param": null,
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "invalid_request_error"
  }
}

List conversations by user

GET
/admin/v1/users/{user_id}/conversations
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Path Parameters

user_id*string

User ID

Formatuuid

Query Parameters

limit?integer|null

Maximum number of results to return

Formatint64
cursor?string|null

Cursor for keyset pagination. Encoded as base64 string.

direction?string|null

Pagination direction: "forward" (default) or "backward".

include_deleted?boolean|null

Include soft-deleted records in results

Response Body

application/json

application/json

application/json

curl -X GET "https://loading/admin/v1/users/497f6eca-6276-4993-bfeb-53cbbbba6f08/conversations"
{
  "data": [
    {
      "created_at": "2019-08-24T14:15:22Z",
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "messages": [
        {
          "content": "string",
          "role": "string"
        }
      ],
      "models": [
        "string"
      ],
      "owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
      "owner_type": "project",
      "pin_order": 0,
      "title": "string",
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ],
  "pagination": {
    "has_more": true,
    "limit": 100,
    "next_cursor": "MTczMzU4MDgwMDAwMDphYmMxMjM0NS02Nzg5LTAxMjMtNDU2Ny0wMTIzNDU2Nzg5YWI",
    "prev_cursor": "string"
  }
}
{
  "error": {
    "code": "budget_exceeded",
    "message": "Budget limit exceeded for monthly period",
    "param": null,
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "invalid_request_error"
  }
}
{
  "error": {
    "code": "budget_exceeded",
    "message": "Budget limit exceeded for monthly period",
    "param": null,
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "invalid_request_error"
  }
}

List all conversations accessible to a user

GET
/admin/v1/users/{user_id}/conversations/accessible
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Path Parameters

user_id*string

User ID

Formatuuid

Query Parameters

limit?integer|null

Maximum number of conversations to return

Formatint64
Range1 <= value <= 1000

Response Body

application/json

application/json

curl -X GET "https://loading/admin/v1/users/497f6eca-6276-4993-bfeb-53cbbbba6f08/conversations/accessible"
{
  "data": [
    {
      "created_at": "2019-08-24T14:15:22Z",
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "messages": [
        {
          "content": "string",
          "role": "string"
        }
      ],
      "models": [
        "string"
      ],
      "owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
      "owner_type": "project",
      "pin_order": 0,
      "title": "string",
      "updated_at": "2019-08-24T14:15:22Z",
      "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
      "project_name": "string",
      "project_slug": "string"
    }
  ],
  "pagination": {
    "has_more": true,
    "limit": 100,
    "next_cursor": "MTczMzU4MDgwMDAwMDphYmMxMjM0NS02Nzg5LTAxMjMtNDU2Ny0wMTIzNDU2Nzg5YWI",
    "prev_cursor": "string"
  }
}
{
  "error": {
    "code": "budget_exceeded",
    "message": "Budget limit exceeded for monthly period",
    "param": null,
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "invalid_request_error"
  }
}