# OTOBO API agents

> List agents on the OTOBO API. The result follows the bearer token user's permission to read agents.

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

`GET /agents` lists valid agents the token's user is allowed to see. The integration user that belongs to a token is included only when that caller may read agents.

Each item has `id`, `login`, `firstName`, `lastName`, and `email`. This route does not create agents and does not return passwords or tokens.

### Python

```python

response = requests.get(
    "https://helpdesk.example.com/otobo/otai-api.pl/v1/agents",
    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/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());
```

### 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/agents"))
    .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/agents");
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;
```

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/)

## Frequently asked questions

### Does GET /agents return passwords?

No. Items contain id, login, name, and email only.

Each item has id, login, firstName, lastName, and email. This route does not create agents and does not return passwords or tokens.

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

### Can I create an agent with this route?

No. Create agents in the admin interface. This route only lists agents the caller may see.

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