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

Users

Users can be members of organizations and projects. Users can have their own API keys and provider configurations.

List organization members

GET
/admin/v1/organizations/{org_slug}/members
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Path Parameters

org_slug*string

Organization 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

application/json

curl -X GET "https://loading/admin/v1/organizations/string/members"
{
  "data": [
    {
      "created_at": "2019-08-24T14:15:22Z",
      "email": "string",
      "external_id": "string",
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "name": "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"
  }
}
{
  "error": {
    "code": "budget_exceeded",
    "message": "Budget limit exceeded for monthly period",
    "param": null,
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "invalid_request_error"
  }
}

Add a member to an organization

POST
/admin/v1/organizations/{org_slug}/members
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Path Parameters

org_slug*string

Organization slug

Request Body

application/json

role?string

Role to assign (defaults to 'member')

user_id*string

User ID to add as member

Formatuuid

Response Body

application/json

application/json

curl -X POST "https://loading/admin/v1/organizations/string/members" \  -H "Content-Type: application/json" \  -d '{    "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"  }'
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"
  }
}
{
  "error": {
    "code": "budget_exceeded",
    "message": "Budget limit exceeded for monthly period",
    "param": null,
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "invalid_request_error"
  }
}

Remove a member from an organization

DELETE
/admin/v1/organizations/{org_slug}/members/{user_id}
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Path Parameters

org_slug*string

Organization slug

user_id*string

User ID

Formatuuid

Response Body

application/json

application/json

curl -X DELETE "https://loading/admin/v1/organizations/string/members/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"
  }
}
{
  "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 project members

GET
/admin/v1/organizations/{org_slug}/projects/{project_slug}/members
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

application/json

curl -X GET "https://loading/admin/v1/organizations/string/projects/string/members"
{
  "data": [
    {
      "created_at": "2019-08-24T14:15:22Z",
      "email": "string",
      "external_id": "string",
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "name": "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"
  }
}
{
  "error": {
    "code": "budget_exceeded",
    "message": "Budget limit exceeded for monthly period",
    "param": null,
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "invalid_request_error"
  }
}

Add a member to a project

POST
/admin/v1/organizations/{org_slug}/projects/{project_slug}/members
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Path Parameters

org_slug*string

Organization slug

project_slug*string

Project slug

Request Body

application/json

role?string

Role to assign (defaults to 'member')

user_id*string

User ID to add as member

Formatuuid

Response Body

application/json

application/json

curl -X POST "https://loading/admin/v1/organizations/string/projects/string/members" \  -H "Content-Type: application/json" \  -d '{    "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"  }'
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"
  }
}
{
  "error": {
    "code": "budget_exceeded",
    "message": "Budget limit exceeded for monthly period",
    "param": null,
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "invalid_request_error"
  }
}

Remove a member from a project

DELETE
/admin/v1/organizations/{org_slug}/projects/{project_slug}/members/{user_id}
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Path Parameters

org_slug*string

Organization slug

project_slug*string

Project slug

user_id*string

User ID

Formatuuid

Response Body

application/json

application/json

curl -X DELETE "https://loading/admin/v1/organizations/string/projects/string/members/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"
  }
}
{
  "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 users

GET
/admin/v1/users
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

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"
{
  "data": [
    {
      "created_at": "2019-08-24T14:15:22Z",
      "email": "string",
      "external_id": "string",
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "name": "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"
  }
}

Create a user

POST
/admin/v1/users
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Request Body

application/json

email?string|null
external_id*string

External identifier (e.g., from SSO provider)

name?string|null

Response Body

application/json

application/json

application/json

curl -X POST "https://loading/admin/v1/users" \  -H "Content-Type: application/json" \  -d '{    "external_id": "string"  }'
{
  "created_at": "2019-08-24T14:15:22Z",
  "email": "string",
  "external_id": "string",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "name": "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"
  }
}
{
  "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 user by ID

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

API key authentication using Bearer token format

In: header

Path Parameters

user_id*string

User ID

Formatuuid

Response Body

application/json

application/json

application/json

curl -X GET "https://loading/admin/v1/users/497f6eca-6276-4993-bfeb-53cbbbba6f08"
{
  "created_at": "2019-08-24T14:15:22Z",
  "email": "string",
  "external_id": "string",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "name": "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"
  }
}
{
  "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 user

PATCH
/admin/v1/users/{user_id}
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Path Parameters

user_id*string

User ID

Formatuuid

Request Body

application/json

email?string|null
name?string|null

Response Body

application/json

application/json

application/json

curl -X PATCH "https://loading/admin/v1/users/497f6eca-6276-4993-bfeb-53cbbbba6f08" \  -H "Content-Type: application/json" \  -d '{}'
{
  "created_at": "2019-08-24T14:15:22Z",
  "email": "string",
  "external_id": "string",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "name": "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"
  }
}
{
  "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 user and all associated data (GDPR Article 17 - Right to Erasure)

DELETE
/admin/v1/users/{user_id}
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Path Parameters

user_id*string

User ID

Formatuuid

Response Body

application/json

application/json

application/json

curl -X DELETE "https://loading/admin/v1/users/497f6eca-6276-4993-bfeb-53cbbbba6f08"
{
  "api_keys_deleted": 0,
  "conversations_deleted": 0,
  "deleted": true,
  "dynamic_providers_deleted": 0,
  "usage_records_deleted": 0,
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
}
{
  "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"
  }
}

Export all user data (GDPR Article 15 - Right of Access)

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

API key authentication using Bearer token format

In: header

Path Parameters

user_id*string

User ID

Formatuuid

Response Body

application/json

application/json

application/json

curl -X GET "https://loading/admin/v1/users/497f6eca-6276-4993-bfeb-53cbbbba6f08/export"
{
  "api_keys": [
    {
      "budget_limit_cents": 0,
      "budget_period": "string",
      "created_at": "2019-08-24T14:15:22Z",
      "expires_at": "2019-08-24T14:15:22Z",
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "key_prefix": "string",
      "last_used_at": "2019-08-24T14:15:22Z",
      "name": "string",
      "revoked_at": "2019-08-24T14:15:22Z"
    }
  ],
  "audit_logs": [
    {
      "action": "string",
      "actor_id": "04f37679-bfbf-4906-b749-01756515cecf",
      "actor_type": "user",
      "details": null,
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "ip_address": "string",
      "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
      "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
      "resource_id": "4d5215ed-38bb-48ed-879a-fdb9ca58522f",
      "resource_type": "string",
      "timestamp": "2019-08-24T14:15:22Z",
      "user_agent": "string"
    }
  ],
  "conversations": [
    {
      "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"
    }
  ],
  "exported_at": "2019-08-24T14:15:22Z",
  "memberships": {
    "organizations": [
      {
        "joined_at": "2019-08-24T14:15:22Z",
        "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
        "org_name": "string",
        "org_slug": "string",
        "role": "string",
        "source": "manual"
      }
    ],
    "projects": [
      {
        "joined_at": "2019-08-24T14:15:22Z",
        "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
        "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
        "project_name": "string",
        "project_slug": "string",
        "role": "string",
        "source": "manual"
      }
    ],
    "teams": [
      {
        "joined_at": "2019-08-24T14:15:22Z",
        "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
        "role": "string",
        "source": "manual",
        "team_id": "810007d0-bec5-486c-b5d1-28fcd8a079ba",
        "team_name": "string",
        "team_slug": "string"
      }
    ]
  },
  "sessions": [
    {
      "created_at": "2019-08-24T14:15:22Z",
      "device_description": "string",
      "expires_at": "2019-08-24T14:15:22Z",
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "ip_address": "string",
      "last_activity": "2019-08-24T14:15:22Z"
    }
  ],
  "usage_summary": {
    "first_request_at": "2019-08-24T14:15:22Z",
    "last_request_at": "2019-08-24T14:15:22Z",
    "request_count": 0,
    "total_cost_microcents": 0,
    "total_tokens": 0
  },
  "user": {
    "created_at": "2019-08-24T14:15:22Z",
    "email": "string",
    "external_id": "string",
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "name": "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"
  }
}
{
  "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 active sessions for a user.

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

API key authentication using Bearer token format

In: header

Path Parameters

user_id*string

User ID

Formatuuid

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://loading/admin/v1/users/497f6eca-6276-4993-bfeb-53cbbbba6f08/sessions"
{
  "data": [
    {
      "created_at": "2019-08-24T14:15:22Z",
      "device": {},
      "expires_at": "2019-08-24T14:15:22Z",
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "last_activity": "2019-08-24T14:15:22Z"
    }
  ],
  "enhanced_enabled": true
}
{
  "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"
  }
}
{
  "error": {
    "code": "budget_exceeded",
    "message": "Budget limit exceeded for monthly period",
    "param": null,
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "invalid_request_error"
  }
}

Revoke all sessions for a user (force logout).

DELETE
/admin/v1/users/{user_id}/sessions
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Path Parameters

user_id*string

User ID

Formatuuid

Response Body

application/json

application/json

application/json

application/json

curl -X DELETE "https://loading/admin/v1/users/497f6eca-6276-4993-bfeb-53cbbbba6f08/sessions"
{
  "sessions_revoked": 0
}
{
  "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"
  }
}
{
  "error": {
    "code": "budget_exceeded",
    "message": "Budget limit exceeded for monthly period",
    "param": null,
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "invalid_request_error"
  }
}

Revoke a specific session for a user.

DELETE
/admin/v1/users/{user_id}/sessions/{session_id}
AuthorizationBearer <token>

API key authentication using Bearer token format

In: header

Path Parameters

user_id*string

User ID

Formatuuid
session_id*string

Session ID to revoke

Formatuuid

Response Body

application/json

application/json

application/json

application/json

curl -X DELETE "https://loading/admin/v1/users/497f6eca-6276-4993-bfeb-53cbbbba6f08/sessions/497f6eca-6276-4993-bfeb-53cbbbba6f08"
{
  "sessions_revoked": 0
}
{
  "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"
  }
}
{
  "error": {
    "code": "budget_exceeded",
    "message": "Budget limit exceeded for monthly period",
    "param": null,
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "invalid_request_error"
  }
}