Skip to main content

Authorisations

Authorisations​

@toothfairyai/sdk@latest…

Authorisation Management Module Handles authorisation CRUD operations for API credentials and OAuth flows.

Accessed via client.authorisations.

Methods​

MethodHTTPEndpoint
createPOSTPOST /authorisation/create
getGETGET /authorisation/get/{id}
updatePOSTPOST /authorisation/update
deleteDELETEDELETE /authorisation/delete/{id}
listGETGET /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​

FieldTypeRequiredDescription
idstringnoUnique identifier
workspaceidstringyesUnique workspace identifier (UUID v4)
namestringyesName of the resource
descriptionstringnoDetailed description of purpose and capabilities
typestringyesType 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​

FieldTypeDescription
idstringUnique identifier for the authorisation
namestringHuman-readable name for the authorisation
tokenSecretstringToken or secret value (encrypted)
descriptionstringDescription of the authorisation's purpose
scopestringOAuth scope or permission scope
grantTypestringOAuth grant type
clientIdstringOAuth client ID
clientSecretstringOAuth client secret (encrypted)
authorizationBaseUrlstringOAuth authorization base URL
staticArgsobjectStatic arguments (JSON object)
tokenBaseUrlstringOAuth token base URL
typestringType 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​

FieldTypeRequiredDescription
idstringyesUnique identifier
workspaceidstringnoUnique workspace identifier (UUID v4)
namestringnoName of the resource
descriptionstringnoDetailed description of purpose and capabilities
typestringnoType 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​

FieldTypeDescription
successbooleanOperation success status
dataobjectResponse data
messagestringOptional 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 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('…');