Authorisations
Authorisations
@toothfairyai/sdk@latest…Authorisation Management Module Handles authorisation CRUD operations for API credentials and OAuth flows.
Accessed via client.authorisations.
Methods
| Method | HTTP | Endpoint |
|---|---|---|
create | POST | POST /authorisation/create |
get | GET | GET /authorisation/get/{id} |
update | POST | POST /authorisation/update |
delete | DELETE | DELETE /authorisation/delete/{id} |
list | GET | GET /authorisation/list |
getByType | — | derived |
search | — | derived |
create
Create a new authorisation
async create(
name: string,
authType: AuthorisationType,
options: {
tokenSecret?: string;
description?: string;
scope?: string;
grantType?: string;
clientId?: string;
clientSecret?: string;
authorizationBaseUrl?: string;
staticArgs?: string;
tokenBaseUrl?: string;
} = {}
)
Endpoint: POST /authorisation/create · API service
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
id | string | no | Unique identifier |
workspaceid | string | yes | Unique workspace identifier (UUID v4) |
name | string | yes | Name of the resource |
description | string | no | Detailed description of purpose and capabilities |
type | string | yes | Type classification (free-form string identifier) |
Allowed: apikey, bearer, oauth, password, env, username_and_password, generic, none, basic |
| createdBy | string | no | ID of the user who created this resource |
| updatedBy | string | no | ID of the user who last updated this resource |
| clientId | string | no | OAuth client ID |
| clientSecret | string | no | OAuth client secret |
| tokenSecret | string | no | Secret reference ID for the token/credential |
| authorizationBaseUrl | string | no | OAuth authorization base URL |
| grantType | string | no | OAuth grant type |
| scope | string | no | OAuth scope |
| staticArgs | string | no | JSON-encoded static arguments for the authorisation |
| tokenBaseUrl | string | no | OAuth token base URL |
| desk_username | string | no | Username for username_and_password authorisation |
| desk_password | string | no | Password for username_and_password authorisation |
Response fields
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the authorisation |
name | string | Human-readable name for the authorisation |
tokenSecret | string | Token or secret value (encrypted) |
description | string | Description of the authorisation's purpose |
scope | string | OAuth scope or permission scope |
grantType | string | OAuth grant type |
clientId | string | OAuth client ID |
clientSecret | string | OAuth client secret (encrypted) |
authorizationBaseUrl | string | OAuth authorization base URL |
staticArgs | object | Static arguments (JSON object) |
tokenBaseUrl | string | OAuth token base URL |
type | string | Type of authorisation |
Allowed: bearer, apikey, oauth, password, env, generic, none, username_and_password, basic |
| workspaceID | string | Unique workspace identifier (UUID v4) |
| createdBy | string | User who created the authorisation |
| updatedBy | string | User who last updated the authorisation |
| createdAt | string | Timestamp when this resource was created |
| updatedAt | string | Timestamp when this resource was last updated |
Example
const result = await client.authorisations.create('…', …);
get
Get an authorisation by ID
async get(authorisationId: string)
Endpoint: GET /authorisation/get/{id} · API service
Response
Returns the Authorisation object — fields documented in the create section above.
Example
const result = await client.authorisations.get('agent-id');
update
Update an existing authorisation
async update(
authorisationId: string,
options: {
name?: string;
tokenSecret?: string;
description?: string;
scope?: string;
grantType?: string;
clientId?: string;
clientSecret?: string;
authorizationBaseUrl?: string;
staticArgs?: string;
tokenBaseUrl?: string;
} = {}
)
Endpoint: POST /authorisation/update · API service
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | Unique identifier |
workspaceid | string | no | Unique workspace identifier (UUID v4) |
name | string | no | Name of the resource |
description | string | no | Detailed description of purpose and capabilities |
type | string | no | Type classification (free-form string identifier) |
Allowed: apikey, bearer, oauth, password, env, username_and_password, generic, none, basic |
| createdBy | string | no | ID of the user who created this resource |
| updatedBy | string | no | ID of the user who last updated this resource |
| clientId | string | no | OAuth client ID |
| clientSecret | string | no | OAuth client secret |
| tokenSecret | string | no | Secret reference ID for the token/credential |
| authorizationBaseUrl | string | no | OAuth authorization base URL |
| grantType | string | no | OAuth grant type |
| scope | string | no | OAuth scope |
| staticArgs | string | no | JSON-encoded static arguments for the authorisation |
| tokenBaseUrl | string | no | OAuth token base URL |
| desk_username | string | no | Username for username_and_password authorisation |
| desk_password | string | no | Password for username_and_password authorisation |
Response
Returns the Authorisation object — fields documented in the create section above.
Example
const result = await client.authorisations.update('agent-id');
delete
Delete an authorisation
async delete(authorisationId: string): Promise<
Endpoint: DELETE /authorisation/delete/{id} · API service
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean | Operation success status |
data | object | Response data |
message | string | Optional success message |
Example
const result = await client.authorisations.delete('agent-id');
list
List all authorisations in the workspace
async list(limit?: number, offset?: number)
Endpoint: GET /authorisation/list · API service
Example
const result = await client.authorisations.list();
getByType
Get authorisations by type
async getByType(authType: AuthorisationType)
Derived method — delegates to another SDK call and performs no direct HTTP request.
Example
const result = await client.authorisations.getByType(…);
search
Search authorisations by name
async search(searchTerm: string)
Derived method — delegates to another SDK call and performs no direct HTTP request.
Example
const result = await client.authorisations.search('…');