# Create a Ticket

> Create a ticket in a LemuTickets project, with its requester, priority, assignee and custom fields

URL: https://docs.lemuai.com/tickets-api/tickets/create

Creates a ticket in a project. The ticket starts in the workflow's first status unless you choose one, and gets the next number in the project (for example `SUP-1042`).

After it is created, the project's assignment rules, SLA policy and AI triage run as they do for tickets made in the app.

**Endpoint:** `POST /v1/tickets`

Needs the `tickets.write` scope in the project.

## Headers

| Name | Required | Description |
|---|---|---|
| `Idempotency-Key` | No, but recommended | A unique value for this ticket, for example your own record id. Sending the same request again returns the first response instead of a second ticket. See [idempotency keys](https://docs.lemuai.com/tickets-api/conventions#idempotency-keys). |

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `project` | string | Yes | Project key (`SUP`) or id. |
| `title` | string | Yes | 1 to 500 characters. |
| `description` | string | No | The body of the ticket. |
| `type` | string | No | Ticket type name (`Complaint`) or id. Defaults to the project's default type. |
| `priority` | string | No | `p1`, `p2`, `p3` or `p4`. Default `p3`. |
| `severity` | string | No | Optional severity, for incidents. |
| `status` | string | No | Status name or id to start in. Defaults to the workflow's first status. |
| `source` | string | No | Where the ticket came from. Default `api`. One of `voice`, `whatsapp`, `web_chat`, `email`, `slack`, `teams`, `api`, `portal`, `web_form`, `manual`, `lemu_copilot`, `automation`, `journey`. |
| `source_ref` | string | No | The id of the item in the source system. If a ticket with the same `source` and `source_ref` exists, it is returned instead of creating a new one. |
| `external_id` | string | No | Your own id for the ticket. Must be unique: a second ticket with the same value fails with `409`. |
| `requester_id` | string (UUID) | No | An existing requester. |
| `requester` | object | No | Find or create the requester inline (see below). Used when `requester_id` is not sent. |
| `account_id` | string (UUID) | No | The customer account. Defaults to the requester's account. |
| `assignee_user_id` | string (UUID) | No | Assign to this person. They must be an active member of your organization. |
| `assignee_team_id` | string (UUID) | No | Assign to this team. Defaults to the project's default team when no person is set. |
| `labels` | array of strings | No | Labels to add. |
| `due_at` | string (date-time) | No | A due date, separate from SLA deadlines. |
| `custom_fields` | object | No | Values for the project's custom fields, by key. Required custom fields must be sent. |
| `parent_id` | string (UUID) | No | Make this a sub-task of another ticket. |
| `restricted` | boolean | No | Only the assignee, the reporter, admins and people it is shared with can see it. Default `false`. |
| `watchers` | array of UUIDs | No | Users to notify about changes. |
| `estimate_minutes` | integer | No | An estimate of the work. |
| `auto_assign` | boolean | No | Run the project's assignment rules. Default `true`. |
| `auto_triage` | boolean | No | Let the AI classify the ticket. Default `true`. |

### Inline requester

Send `requester` to link the ticket to a customer without looking them up first. LemuTickets finds an existing requester by `lemu_contact_id`, email, phone, WhatsApp id or `external_id`, in that order, and creates one if there is no match. Details on an existing requester are only filled in where they are empty, never overwritten.

| Field | Type | Description |
|---|---|---|
| `name` | string | Full name. |
| `email` | string | Email address. |
| `phone` | string | Phone number. Numbers without a country code are read as Indian (`+91`). |
| `whatsapp_id` | string | WhatsApp number. |
| `external_id` | string | Your own id for the customer. |
| `lemu_contact_id` | integer | The contact's id in Lemu AI, if you use both products. |
| `language` | string | Preferred language, for example `hi` or `en`. |

A new requester whose email domain matches an [account](https://docs.lemuai.com/tickets-api/accounts/list) is added to that account.

**Example request:**
```bash
curl -X POST https://api.tickets.lemuai.com/v1/tickets \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ERP-CMP-58213" \
  -d '{
    "project": "SUP",
    "type": "Complaint",
    "title": "Refund not received for order 58213",
    "description": "Customer paid on 12 November and the order was cancelled the same day.",
    "priority": "p2",
    "external_id": "ERP-CMP-58213",
    "labels": ["refund"],
    "custom_fields": { "order_id": "58213" },
    "requester": {
      "name": "Priya Sharma",
      "email": "priya@example.com",
      "phone": "+919876543210",
      "external_id": "CUST-20931"
    }
  }'
```

## Response

**`201`** with the new ticket. The `ETag` header holds its `version`.
```json
{
  "id": "2f9c7e1a-5b3d-4c8e-9a6f-1d0e2b4c6a8f",
  "key": "SUP-1042",
  "number": 1042,
  "project": { "id": "3b0f6c1e-8a2d-4f5b-9c71-0e4d2a6b8f13", "key": "SUP", "name": "Customer Support" },
  "type": { "id": "9d2e4f60-1b3a-4c8d-a7e5-6f0b2c9d1e47", "name": "Complaint", "icon": "message-square-warning", "color": "red" },
  "title": "Refund not received for order 58213",
  "description": "Customer paid on 12 November and the order was cancelled the same day.",
  "status": { "id": "4d7b9e1f-3a5c-4e8b-a0d2-f4b6c8e0a1d3", "name": "New", "category": "new", "color": "sky" },
  "status_category": "new",
  "priority": "p2",
  "severity": null,
  "source": "api",
  "source_ref": null,
  "requester": {
    "id": "8b4d6f2a-0c1e-4a3b-9d5f-7e6a8c0b2d4f",
    "name": "Priya Sharma",
    "email": "priya@example.com",
    "phone": "+919876543210",
    "is_vip": false,
    "account_id": null
  },
  "account_id": null,
  "assignee": null,
  "team": { "id": "1c3e5a7b-9d2f-4e6a-b8c0-a2e4f6b8d0c1", "name": "L1 Support" },
  "reporter": {
    "id": "d1f3b5a7-c9e2-4b4d-8f6a-0c2e4a6b8d0f",
    "name": "API: ERP sync",
    "email": "ltk_live_ab12cd34@bots.lemutickets",
    "avatar_url": null
  },
  "parent_id": null,
  "labels": ["refund"],
  "due_at": null,
  "restricted": false,
  "sla": {
    "policy_id": "7e9a1c3b-5d2f-4a6e-8b0c-1d3f5a7c9e2b",
    "targets": {
      "first_response": {
        "minutes": 240.0,
        "business_hours": true,
        "status": "running",
        "started_at": "2026-11-25T09:12:40.512000+00:00",
        "due_at": "2026-11-25T13:12:40.512000+00:00",
        "met_at": null,
        "breached_at": null
      }
    },
    "paused": false,
    "next_due_at": "2026-11-25T13:12:40.512000+00:00",
    "breached": false
  },
  "sla_next_due_at": "2026-11-25T13:12:40.512000+00:00",
  "sla_breached": false,
  "escalation_level": 0,
  "first_response_at": null,
  "resolved_at": null,
  "closed_at": null,
  "reopened_count": 0,
  "csat_score": null,
  "time_spent_minutes": 0,
  "estimate_minutes": null,
  "custom_fields": { "order_id": "58213" },
  "ai": {},
  "lemu": {},
  "channel_thread": {},
  "external_id": "ERP-CMP-58213",
  "merged_into_id": null,
  "version": 1,
  "created_at": "2026-11-25T09:12:40.512000+00:00",
  "updated_at": "2026-11-25T09:12:40.512000+00:00"
}
```

See [the ticket object](https://docs.lemuai.com/tickets-api/tickets/overview) for every field. Assignment, SLA and triage can still change the ticket right after it is created, so `version` and the assignee may move on quickly.

**`200`** with the existing ticket, when a ticket with the same `source` and `source_ref` already exists.

## Errors

| Status | `code` | When |
|---|---|---|
| `404` | `project_not_found` | No project with that key or id, or the key cannot access it |
| `409` | `duplicate_external_id` | A ticket with this `external_id` exists. `data.key` is its key |
| `409` | `idempotency_mismatch` | The `Idempotency-Key` was used before with a different body |
| `422` | `project_archived` | The project is archived |
| `422` | `invalid_type`, `invalid_status` | The type or status does not exist in this project |
| `422` | `invalid_assignee`, `invalid_team`, `invalid_requester` | The assignee, team or requester does not exist |
| `422` | `invalid_source` | `source` is not one of the allowed values |
| `422` | `invalid_custom_fields` | A custom field value is wrong or a required one is missing. See `field_errors` |
| `422` | `invalid_fields` | A field has the wrong type or length. See `field_errors` |
