# Build on Lagotto

Open tickets from your own product, keep another system in step with your support desk, or let an AI assistant work your queue.

[REST API](https://www.lagottolabs.ai/docs/api.md): Tickets, messages, customers and people, as JSON.

[Webhooks](https://www.lagottolabs.ai/docs/webhooks.md): Hear about a new ticket or message the moment it happens.

[MCP server](https://www.lagottolabs.ai/docs/mcp.md): Connect an AI assistant to your support desk.

## Quick start

### 1. Create an API key

Sign in to your workspace as an administrator and go to **Settings, API keys**. Give the key a name, choose whether it may change things or only read, and pick the person it acts as. The token starts with `lg_` and is shown once, so copy it somewhere safe.

### 2. Check it works

The API lives at your workspace's own address, the one you sign in at. Replace `YOUR-WORKSPACE` below with yours.

```
export API_TOKEN=lg_your_token

curl https://YOUR-WORKSPACE.lagottolabs.ai/api/v1/me \\
  -H "Authorization: Bearer $API_TOKEN"
```

You get back who the token is:

```
{
  "data": {
    "user": {
      "id": 12,
      "name": "Alice Agent",
      "email": "alice@yourcompany.com",
      "role": "agent",
      "active": true,
      "group_ids": [
        3
      ],
      "created_at": "2025-11-03T16:20:00Z",
      "updated_at": "2026-01-12T08:02:11Z"
    },
    "workspace": {
      "name": "Your Company",
      "subdomain": "your-workspace",
      "time_zone": "UTC"
    },
    "access": "write"
  }
}
```

### 3. Open a ticket

This is what a contact form on your own site would send. The ticket is opened in your customer's name, routed by your triggers, and your agents are notified, exactly as if the customer had emailed.

```
curl -X POST https://YOUR-WORKSPACE.lagottolabs.ai/api/v1/tickets \
  -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "customer": {
    "email": "carol@example.com",
    "name": "Carol Customer"
  },
  "subject": "Charged twice this month",
  "body": "I was charged twice this month. Can you refund the duplicate?",
  "cc": [
    "accounts@example.com"
  ]
}'
```

### 4. Read your queue

```
curl "https://YOUR-WORKSPACE.lagottolabs.ai/api/v1/tickets?status=open&per_page=10" \\
  -H "Authorization: Bearer $API_TOKEN"
```

## Where next

- [The REST API reference](https://www.lagottolabs.ai/docs/api.md): every endpoint, with examples.
- [Webhooks](https://www.lagottolabs.ai/docs/webhooks.md): be told when something happens instead of asking.
- [The MCP server](https://www.lagottolabs.ai/docs/mcp.md): the same data, for AI assistants.
- [Customer data](https://www.lagottolabs.ai/docs/data.md): show each customer's records from your own product on their tickets.
- [The OpenAPI document](https://www.lagottolabs.ai/openapi.json): generate a client, or import it into your API tool.
