# OTOBO API

> Install the OTOBO API package, switch it on in Admin, and call tickets with a one-time bearer token.

- HTML: https://otobo-docs.softoft.de/en/otobo-api/overview/
- Markdown: https://otobo-docs.softoft.de/en/otobo-api/overview.md

After [installation](https://otobo-docs.softoft.de/en/otobo-api/installation/) you get an **API** entry in the admin area. Switch the API on, generate a token, and call normal HTTP routes. The token is shown once, it expires, and the package creates an agent user for it.

This is not the [Generic Interface](https://otobo-docs.softoft.de/en/administration/automation/web-services/). You do not build a webservice, a route map, or an operation invoker. The package already exposes the routes below. The steps are on [Installation](https://otobo-docs.softoft.de/en/otobo-api/installation/). Tokens and the admin route list are in the [REST API](https://otobo-docs.softoft.de/en/administration/automation/rest-api/) guide. An AI client such as Claude or Cursor does not call these routes itself. It talks to the [OTOBO MCP Server](https://otobo-docs.softoft.de/en/administration/automation/otobo-mcp-server/), which calls OTOBO for it.

## Turn the API on

Install the **REST-API** package, switch the API on, and copy the token: [Installation](https://otobo-docs.softoft.de/en/otobo-api/installation/).

What the token may do is whatever that user may do: groups, roles, and queue permissions. Change those on the agent, not on a second permission screen. Each agent can also create a personal token under personal preferences. A personal token acts as that agent.

Works on OTOBO 11. Send `Authorization: Bearer` and `Accept: application/json`.

## Routes

| What                                                                        | Method and path                                      |
| --------------------------------------------------------------------------- | ---------------------------------------------------- |
| [Tickets](https://otobo-docs.softoft.de/en/otobo-api/tickets/)                                           | `GET`, `POST /tickets`, `GET`, `PATCH /tickets/{id}` |
| [FAQ](https://otobo-docs.softoft.de/en/otobo-api/faq/)                                                   | `GET /faqs`, `GET /faqs/{id}`                        |
| [Queues, states, types, services, dynamic fields](https://otobo-docs.softoft.de/en/otobo-api/catalogue/) | `GET /queues` and the other catalogue lists          |
| [Agents](https://otobo-docs.softoft.de/en/otobo-api/agents/)                                             | `GET /agents`                                        |
| [Customers](https://otobo-docs.softoft.de/en/otobo-api/customers/)                                       | `GET /customers`, `GET /customer-users`              |

Base URL: `https://helpdesk.example.com/otobo/otai-api.pl/v1`

Longer examples, one page per language:

- [Python](https://otobo-docs.softoft.de/en/otobo-api/python/)
- [TypeScript](https://otobo-docs.softoft.de/en/otobo-api/typescript/)
- [Java](https://otobo-docs.softoft.de/en/otobo-api/java/)
- [PHP](https://otobo-docs.softoft.de/en/otobo-api/php/)

## First call

### Python

```python

response = requests.get(
    "https://helpdesk.example.com/otobo/otai-api.pl/v1/tickets?state=new&limit=20",
    headers={"Authorization": "Bearer YOUR_TOKEN"},
    timeout=30,
)
response.raise_for_status()
print(response.json())
```

### TypeScript

```typescript
const response = await fetch(
  "https://helpdesk.example.com/otobo/otai-api.pl/v1/tickets?state=new&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());
```

### Java

```java

HttpClient client = HttpClient.newHttpClient();
HttpRequest.BodyPublisher body = HttpRequest.BodyPublishers.noBody();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://helpdesk.example.com/otobo/otai-api.pl/v1/tickets?state=new&limit=20"))
    .header("Authorization", "Bearer YOUR_TOKEN")
    .header("Accept", "application/json")
    .method("GET", body)
    .build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

### PHP

```php
<?php
$ch = curl_init("https://helpdesk.example.com/otobo/otai-api.pl/v1/tickets?state=new&limit=20");
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer YOUR_TOKEN",
        "Accept: application/json",
        "Content-Type: application/json",
    ],
    CURLOPT_RETURNTRANSFER => true,
]);
$body = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $body;
```

## Frequently asked questions

### Where do I enable the OTOBO API?

Install the package, then open Admin and the API menu. Switch the API on and generate a token. The token is shown once.

- [OTOBO API](https://otobo-docs.softoft.de/en/otobo-api/overview/)
- [OTOBO Admin Manual](https://doc.otobo.org/manual/admin/11.0/en/content/index.html)

### Is this the Generic Interface?

No. The Generic Interface is a separate webservice builder. This package adds its own HTTP routes and does not use that builder.

This is not the Generic Interface. You do not build a webservice, a route map, or an operation invoker. The package already exposes the routes below.

- [OTOBO API](https://otobo-docs.softoft.de/en/otobo-api/overview/)
- [OTOBO Admin Manual](https://doc.otobo.org/manual/admin/11.0/en/content/index.html)
