MENU navbar-image

Introduction

API reference for authentication, tenant administration, users, plans, and LLM models.

This documentation aims to provide all the information you need to work with our API.

<aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile).
You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).</aside>

Authenticating requests

To authenticate requests, include an Authorization header with the value "Bearer Bearer {YOUR_JWT_TOKEN}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

Use the POST /api/auth/login endpoint to get a JWT access token, then send it as Authorization: Bearer {token}.

Authentication

User login.

Authenticate a user and return a JWT access token.

Example request:
curl --request POST \
    "https://api.onegpt.ai.test/api/auth/login" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"email\": \"admin@example.com\",
    \"password\": \"secret1234\"
}"
const url = new URL(
    "https://api.onegpt.ai.test/api/auth/login"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "admin@example.com",
    "password": "secret1234"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
    "token_type": "bearer",
    "expires_in": 3600,
    "user": {
        "id": 1,
        "email": "admin@example.com"
    }
}
 

Example response (401):


{
    "error": "Unauthorized"
}
 

Request      

POST api/auth/login

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

email   string     

User email. Example: admin@example.com

password   string     

User password. Example: secret1234

Reset password.

Reset a user password using a valid password reset token.

Example request:
curl --request POST \
    "https://api.onegpt.ai.test/api/auth/reset-password" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"token\": \"7fca298a-token\",
    \"email\": \"user@example.com\",
    \"password\": \"newPassword123\",
    \"password_confirmation\": \"newPassword123\"
}"
const url = new URL(
    "https://api.onegpt.ai.test/api/auth/reset-password"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "token": "7fca298a-token",
    "email": "user@example.com",
    "password": "newPassword123",
    "password_confirmation": "newPassword123"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "message": "Your password has been reset!"
}
 

Example response (400):


{
    "message": "This password reset token is invalid."
}
 

Request      

POST api/auth/reset-password

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

token   string     

Password reset token. Example: 7fca298a-token

email   string     

User email. Example: user@example.com

password   string     

New password (min 8 chars). Example: newPassword123

password_confirmation   string     

Must match password. Example: newPassword123

User logout.

requires authentication

Invalidates the current JWT token.

Example request:
curl --request POST \
    "https://api.onegpt.ai.test/api/auth/logout" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/auth/logout"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Example response (200):


{
    "message": "Successfully logged out"
}
 

Request      

POST api/auth/logout

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Current authenticated user.

requires authentication

Returns authenticated user profile with roles and tenant.

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/auth/me" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/auth/me"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):


{
    "id": 1,
    "email": "admin@example.com",
    "roles": [],
    "tenant": null
}
 

Example response (401):


{
    "error": "Not authenticated"
}
 

Request      

GET api/auth/me

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Users

Export user statistics.

requires authentication

Exports user statistics as a downloadable file.

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/users/export" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/users/export"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "The route api/users/export could not be found."
}
 

Request      

GET api/users/export

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Sync users for all tenants.

requires authentication

Triggers full synchronization from the external source for all tenants.

Example request:
curl --request POST \
    "https://api.onegpt.ai.test/api/users/sync-all" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/users/sync-all"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/users/sync-all

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Sync users for one tenant.

requires authentication

Triggers synchronization for a specific tenant.

Example request:
curl --request POST \
    "https://api.onegpt.ai.test/api/users/sync/1" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/users/sync/1"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/users/sync/{tenantId}

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

tenantId   integer     

Tenant ID. Example: 1

Tenant list for filters.

requires authentication

Returns lightweight tenant list (id, name).

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/users/tenants-list" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/users/tenants-list"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "The route api/users/tenants-list could not be found."
}
 

Request      

GET api/users/tenants-list

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

List users.

requires authentication

Returns paginated users with optional filters.

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/users?tenant_id=all&search=john&page=1&per_page=15" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/users"
);

const params = {
    "tenant_id": "all",
    "search": "john",
    "page": "1",
    "per_page": "15",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "The route api/users could not be found."
}
 

Request      

GET api/users

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Query Parameters

tenant_id   string  optional    

Optional tenant filter (all, unassigned, or tenant id). Example: all

search   string  optional    

Optional search keyword for name/email. Example: john

page   integer  optional    

Optional page number. Example: 1

per_page   integer  optional    

Optional page size. Example: 15

Service users stats.

requires authentication

Returns per-user usage breakdown for authenticated user's tenant.

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/users/service-users" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/users/service-users"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "The route api/users/service-users could not be found."
}
 

Request      

GET api/users/service-users

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

User model breakdown.

requires authentication

Returns model-level usage breakdown for one user in a tenant and date range.

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/users/1/model-breakdown/user_123?start_date=2026-01-01&end_date=2026-01-31" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/users/1/model-breakdown/user_123"
);

const params = {
    "start_date": "2026-01-01",
    "end_date": "2026-01-31",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "The route api/users/1/model-breakdown/user_123 could not be found."
}
 

Request      

GET api/users/{tenantId}/model-breakdown/{userId}

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

tenantId   integer     

Tenant ID. Example: 1

userId   string     

User identifier from statistics source. Example: user_123

Query Parameters

start_date   string  optional    

Optional start date (YYYY-MM-DD). Example: 2026-01-01

end_date   string  optional    

Optional end date (YYYY-MM-DD). Example: 2026-01-31

Show user.

requires authentication

Returns a single user by ID.

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/users/15" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/users/15"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "The route api/users/15 could not be found."
}
 

Request      

GET api/users/{id}

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

User ID. Example: 15

Create user.

requires authentication

Creates a new user for the permitted tenant scope.

Example request:
curl --request POST \
    "https://api.onegpt.ai.test/api/users" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/users"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/users

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Update user.

requires authentication

Updates an existing user.

Example request:
curl --request PUT \
    "https://api.onegpt.ai.test/api/users/15" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/users/15"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "PUT",
    headers,
}).then(response => response.json());

Request      

PUT api/users/{id}

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

User ID. Example: 15

Delete user.

requires authentication

Deletes a user by ID.

Example request:
curl --request DELETE \
    "https://api.onegpt.ai.test/api/users/15" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/users/15"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Request      

DELETE api/users/{id}

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

User ID. Example: 15

User stats view.

requires authentication

Returns dashboard statistics for the authenticated user's tenant scope.

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/users/stats/view" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/users/stats/view"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "The route api/users/stats/view could not be found."
}
 

Request      

GET api/users/stats/view

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

My usage stats.

requires authentication

Returns stats for the authenticated user.

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/my-stats?start_date=2026-01-01&end_date=2026-01-31" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/my-stats"
);

const params = {
    "start_date": "2026-01-01",
    "end_date": "2026-01-31",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "The route api/my-stats could not be found."
}
 

Request      

GET api/my-stats

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Query Parameters

start_date   string  optional    

Optional start date (YYYY-MM-DD). Example: 2026-01-01

end_date   string  optional    

Optional end date (YYYY-MM-DD). Example: 2026-01-31

Tenants

Global stats.

requires authentication

Return global statistics (super-admin) or tenant-specific equivalent.

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/tenants/global-stats?start_date=2026-01-01&end_date=2026-01-31" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/tenants/global-stats"
);

const params = {
    "start_date": "2026-01-01",
    "end_date": "2026-01-31",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "The route api/tenants/global-stats could not be found."
}
 

Request      

GET api/tenants/global-stats

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Query Parameters

start_date   string  optional    

Optional start date (YYYY-MM-DD). Example: 2026-01-01

end_date   string  optional    

Optional end date (YYYY-MM-DD). Example: 2026-01-31

Tenant detailed stats.

requires authentication

Get detailed usage/cost metrics for a tenant and optional date range.

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/tenants/1/detailed-stats?start_date=2026-01-01&end_date=2026-01-31" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/tenants/1/detailed-stats"
);

const params = {
    "start_date": "2026-01-01",
    "end_date": "2026-01-31",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "The route api/tenants/1/detailed-stats could not be found."
}
 

Request      

GET api/tenants/{id}/detailed-stats

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

Tenant ID. Example: 1

Query Parameters

start_date   string  optional    

Optional start date (YYYY-MM-DD). Example: 2026-01-01

end_date   string  optional    

Optional end date (YYYY-MM-DD). Example: 2026-01-31

Tenant subscriptions.

requires authentication

Returns subscription history for a tenant.

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/tenants/1/subscriptions" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/tenants/1/subscriptions"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "The route api/tenants/1/subscriptions could not be found."
}
 

Request      

GET api/tenants/{id}/subscriptions

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

Tenant ID. Example: 1

Add tenant subscription.

requires authentication

Creates a manual subscription entry for a tenant.

Example request:
curl --request POST \
    "https://api.onegpt.ai.test/api/tenants/1/subscriptions" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/tenants/1/subscriptions"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/tenants/{id}/subscriptions

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

Tenant ID. Example: 1

List tenants.

requires authentication

Returns all tenants.

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/tenants" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/tenants"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "The route api/tenants could not be found."
}
 

Request      

GET api/tenants

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Show tenant.

requires authentication

Returns a tenant with users.

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/tenants/1" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/tenants/1"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):


{
    "message": "Tenant not found"
}
 

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "The route api/tenants/1 could not be found."
}
 

Request      

GET api/tenants/{id}

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

Tenant ID. Example: 1

Create tenant.

requires authentication

Creates a new tenant.

Example request:
curl --request POST \
    "https://api.onegpt.ai.test/api/tenants" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/tenants"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/tenants

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Update tenant.

requires authentication

Updates an existing tenant.

Example request:
curl --request PUT \
    "https://api.onegpt.ai.test/api/tenants/1" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/tenants/1"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "PUT",
    headers,
}).then(response => response.json());

Request      

PUT api/tenants/{id}

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

Tenant ID. Example: 1

Delete tenant.

requires authentication

Deletes a tenant by ID.

Example request:
curl --request DELETE \
    "https://api.onegpt.ai.test/api/tenants/1" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/tenants/1"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Request      

DELETE api/tenants/{id}

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

Tenant ID. Example: 1

Plans

List plans.

requires authentication

Returns all subscription plans.

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/plans" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/plans"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "The route api/plans could not be found."
}
 

Request      

GET api/plans

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Show plan.

requires authentication

Returns a specific plan.

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/plans/1" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/plans/1"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "The route api/plans/1 could not be found."
}
 

Request      

GET api/plans/{id}

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

Plan ID. Example: 1

Create plan.

requires authentication

Creates a subscription plan.

Example request:
curl --request POST \
    "https://api.onegpt.ai.test/api/plans" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/plans"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/plans

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Update plan.

requires authentication

Updates an existing plan.

Example request:
curl --request PUT \
    "https://api.onegpt.ai.test/api/plans/1" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/plans/1"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "PUT",
    headers,
}).then(response => response.json());

Request      

PUT api/plans/{id}

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

Plan ID. Example: 1

Delete plan.

requires authentication

Deletes a plan.

Example request:
curl --request DELETE \
    "https://api.onegpt.ai.test/api/plans/1" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/plans/1"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Request      

DELETE api/plans/{id}

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

Plan ID. Example: 1

LLM Models

List active LLM models.

requires authentication

Returns active LLM models with their current prices.

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/llm-models" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/llm-models"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "The route api/llm-models could not be found."
}
 

Request      

GET api/llm-models

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Sync models from OpenRouter.

requires authentication

Runs the sync command and returns command output.

Example request:
curl --request POST \
    "https://api.onegpt.ai.test/api/llm-models/sync" \
    --header "Authorization: Bearer Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/llm-models/sync"
);

const headers = {
    "Authorization": "Bearer Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/llm-models/sync

Headers

Authorization        

Example: Bearer Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Social Authentication

Redirect the user to the provider authentication page.

Redirects to OAuth provider login flow.

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/auth/google/redirect" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/auth/google/redirect"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "The route api/auth/google/redirect could not be found."
}
 

Request      

GET api/auth/{provider}/redirect

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

provider   string     

OAuth provider. Currently only google is supported. Example: google

Obtain the user information from provider.

Completes social login callback and redirects to frontend with token.

Example request:
curl --request GET \
    --get "https://api.onegpt.ai.test/api/auth/google/callback" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://api.onegpt.ai.test/api/auth/google/callback"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "The route api/auth/google/callback could not be found."
}
 

Request      

GET api/auth/{provider}/callback

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

provider   string     

OAuth provider. Currently only google is supported. Example: google