Skip to content

OTOBO API TypeScript examples

Call the OTOBO API from TypeScript with fetch. There is no npm package to publish for this API. The examples below are the whole client: a bearer token and JSON.

Replace YOUR_TOKEN with a token from Admin → API or from an agent’s personal API token. The base URL on this OTOBO system is https://helpdesk.example.com/otobo/otai-api.pl/v1. How tokens expire and how rights follow the user is on the authentication page.

Fields and errors: Tickets.

const payload = {
"title": "Printer offline",
"queue": "Service Desk",
"state": "new",
"priority": "3 normal",
"customerUser": "max@example.com",
"article": {
"subject": "Printer offline",
"body": "Floor 2, the device shows no paper path.",
"mimeType": "text/plain"
}
};
const response = await fetch("https://helpdesk.example.com/otobo/otai-api.pl/v1/tickets", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_TOKEN",
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());

Fields and errors: FAQ.

const response = await fetch("https://helpdesk.example.com/otobo/otai-api.pl/v1/faqs?query=vpn&limit=20", {
method: "GET",
headers: {
Authorization: "Bearer YOUR_TOKEN",
Accept: "application/json",
},
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());

Fields and errors: Queues.

const response = await fetch("https://helpdesk.example.com/otobo/otai-api.pl/v1/queues", {
method: "GET",
headers: {
Authorization: "Bearer YOUR_TOKEN",
Accept: "application/json",
},
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());

Fields and errors: Agents.

const response = await fetch("https://helpdesk.example.com/otobo/otai-api.pl/v1/agents", {
method: "GET",
headers: {
Authorization: "Bearer YOUR_TOKEN",
Accept: "application/json",
},
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());

Fields and errors: Customer users.

const response = await fetch("https://helpdesk.example.com/otobo/otai-api.pl/v1/customer-users?search=max@example.com", {
method: "GET",
headers: {
Authorization: "Bearer YOUR_TOKEN",
Accept: "application/json",
},
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());

Frequently asked questions

Do I need a TypeScript SDK for the OTOBO API?

No. The examples send HTTP with a bearer token. There is no package to publish or upgrade.

Call the OTOBO API from TypeScript with fetch. There is no npm package to publish for this API. The examples below are the whole client: a bearer token and JSON.

Sources

Where do I send the token?

In the Authorization: Bearer header. The base URL ends with /otai-api.pl/v1.

Sources

Workflows and integrations

Web services, processes, and connections that fit your landscape.