# Get Ticket(s)

`GET /api/tickets/{id}`



- **Group:** Tickets
- **Since:** v0.0.0
- **Authentication:** `authtoken` header, created under Setup > API > API Management
- **HTML version:** /apiguide/tickets/get-ticket/

## Headers

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `authtoken` | String | **required** | Authentication token, generated from admin area |

## Parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | Number | optional | Optional Ticket unique ID. If not provided, returns all tickets with pagination |
| `page` | Number | optional | Optional Page number for pagination (when ID is not provided) (default: `1`) |
| `per_page` | Number | optional | Optional Number of items per page (min: 1, max: 100, when ID is not provided) (default: `20`) |

## Example request

```bash
curl -X GET "https://yoursite.com/api/tickets/123" \
  -H "authtoken: YOUR_API_TOKEN"
```

## Success response

### Success-Response (Single Ticket):

```json
HTTP/1.1 200 OK
{
    "id": "7",
    "ticketid": "7",
    "adminreplying": "0",
    "userid": "0",
    "contactid": "0",
    "email": null,
    "name": "Trung bình",
    "department": "1",
    "priority": "2",
    "status": "1",
    "service": "1",
    "ticketkey": "8ef33d61bb0f26cd158d56cc18b71c02",
    "subject": "Ticket ER",
    "message": "Ticket ER",
    "admin": "5",
    "date": "2019-04-10 03:08:21",
    "project_id": "5",
    "lastreply": null,
    "clientread": "0",
    "adminread": "1",
    "assigned": "5",
    "line_manager": "8",
    "milestone": "27",
    ...
}
```

### Success-Response (All Tickets with Pagination):

```json
HTTP/1.1 200 OK
{
  "data": [
    {
      "id": "7",
      "ticketid": "7",
      "subject": "Ticket ER",
      ...
    }
  ],
  "meta": {
    "current_page": 1,
    "per_page": 20,
    "total": 137,
    "last_page": 7
  }
}
```

## Error responses

### Error-Response:

```json
HTTP/1.1 404 Not Found
{
  "status": false,
  "message": "No data were found"
}
```

---

Perfex CRM REST API by Themesic Interactive. Full reference: /apiguide/
