Source: https://atomicwork.docs.pageloop.ai/api-reference/creating-requests

# Creating requests, incidents and problems

There are two endpoints for creating tickets with an API key. Which one you use depends on the type of ticket you want to create.

| Ticket type     | Endpoint                       | `request_type`                |
| --------------- | ------------------------------ | ----------------------------- |
| General request | `POST /api/v1/requests`        | `REQUEST` (or omit the field) |
| General request | `POST /api/v1/requests/create` | `REQUEST`                     |
| Incident        | `POST /api/v1/requests/create` | `INCIDENT`                    |
| Service request | `POST /api/v1/requests/create` | `SERVICE_REQUEST`             |
| Problem         | `POST /api/v1/requests/create` | `PROBLEM`                     |

> [!WARNING]
>
> `POST /api/v1/requests` creates **general requests only**. Sending `"request_type": "INCIDENT"`, `"SERVICE_REQUEST"` or `"PROBLEM"` to it returns `400 Bad Request` with a message such as `Could not resolve type id 'INCIDENT' as a subtype of CreateGeneralRequestDto`. Use `POST /api/v1/requests/create` for every other ticket type.

## `POST /api/v1/requests/create`

Creates a ticket of any type. The `request_type` field in the body selects the ticket type and decides which additional fields are accepted (for example `impact` and `urgency` on incidents).

### Create an incident

```bash
curl -X POST "https://{tenant}.atomicwork.com/api/v1/requests/create" \
     -H "X-Api-Key: <your-api-key>" \
     -H "Content-Type: application/json" \
     -d '{
           "request_type": "INCIDENT",
           "request_source": "API",
           "workspace_id": 48,
           "subject": "VPN is down for the London office",
           "description": "Users in London cannot connect to the VPN since 09:00 UTC."
         }'
```

### Create a problem

```bash
curl -X POST "https://{tenant}.atomicwork.com/api/v1/requests/create" \
     -H "X-Api-Key: <your-api-key>" \
     -H "Content-Type: application/json" \
     -d '{
           "request_type": "PROBLEM",
           "request_source": "API",
           "workspace_id": 48,
           "subject": "Recurring VPN outages",
           "description": "Third VPN outage this month; root cause unknown."
         }'
```

### Create a service request

```bash
curl -X POST "https://{tenant}.atomicwork.com/api/v1/requests/create" \
     -H "X-Api-Key: <your-api-key>" \
     -H "Content-Type: application/json" \
     -d '{
           "request_type": "SERVICE_REQUEST",
           "request_source": "API",
           "workspace_id": 48,
           "subject": "New laptop for a starter",
           "description": "Please provision a laptop for the new hire starting Monday."
         }'
```

### Response

A successful call returns **`200 OK`** (not `201 Created`) with the created ticket, including its `display_id` (for example `IOINC-169`) and the resolved `request_type`.

## Field reference

| Field                                 | Type       | Required                  | Notes                                                                                                                                                                                                                                                                              |
| ------------------------------------- | ---------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `request_type`                        | string     | Yes on `/requests/create` | One of `REQUEST`, `INCIDENT`, `SERVICE_REQUEST`, `PROBLEM`. Must be the **string enum name** — the integer values used internally (for example `2` for incidents) are rejected. On `POST /api/v1/requests` it must be `REQUEST` or omitted.                                        |
| `workspace_id`                        | integer    | Recommended               | **Body field.** There is no `X-Workspace-Id` header. If omitted, the ticket is created in the tenant's default workspace — if that workspace has incidents or problems disabled, the call fails even though the workspace you intended has them enabled. Always set it explicitly. |
| `request_source`                      | string     | No                        | Use `API` for tickets created through the public API.                                                                                                                                                                                                                              |
| `subject`                             | string     | Recommended               | Ticket title.                                                                                                                                                                                                                                                                      |
| `description`                         | string     | No                        | Ticket body.                                                                                                                                                                                                                                                                       |
| `status`                              | string     | No                        | Defaults to the workspace's initial status.                                                                                                                                                                                                                                        |
| `priority`                            | string     | No                        | Defaults from the workspace configuration.                                                                                                                                                                                                                                         |
| `impact`, `urgency`                   | string     | No                        | Incident-only. Default from the workspace configuration.                                                                                                                                                                                                                           |
| `requester`                           | integer    | No                        | User ID. Defaults to the owner of the API key.                                                                                                                                                                                                                                     |
| `assignee`                            | integer    | No                        | User ID to assign the ticket to.                                                                                                                                                                                                                                                   |
| `agent_group`                         | integer    | No                        | Agent group ID.                                                                                                                                                                                                                                                                    |
| `category`, `subcategory`, `cti_item` | string     | No                        | Classification hierarchy.                                                                                                                                                                                                                                                          |
| `tags`                                | integer\[] | No                        | Tag IDs.                                                                                                                                                                                                                                                                           |
| `custom_fields`                       | object     | No                        | Custom field values keyed by field key.                                                                                                                                                                                                                                            |

## `POST /api/v1/requests`

Creates a general request. It accepts the same body as above, but `request_type` must be `REQUEST` or omitted. Prefer `POST /api/v1/requests/create` for new integrations so the same code path can create every ticket type.

```bash
curl -X POST "https://{tenant}.atomicwork.com/api/v1/requests" \
     -H "X-Api-Key: <your-api-key>" \
     -H "Content-Type: application/json" \
     -d '{
           "request_source": "API",
           "workspace_id": 48,
           "subject": "Question about expense policy",
           "description": "Where can I find the current expense limits?"
         }'
```

> [!NOTE]
>
> `POST /api/v1/incidents` is not available with API-key authentication and returns `400` with `"URL Not Allowed"`. Use `POST /api/v1/requests/create` with `"request_type": "INCIDENT"` instead.
