# Support Ticket API V3

## Overview

The Support Ticket API enables applications to create support tickets in Sprinklr Care Lite and retrieve the case custom fields configured for a workspace.

Use this API to:

* Create a support ticket for an end user.
* Add case-level and message-level custom properties.
* Retrieve available case custom fields.
* Retrieve the case number after ticket creation.


## API Endpoints

| Operation | Method | Path |
|  --- | --- | --- |
| Create a support ticket | `POST` | `/api/v3/supportTicket` |
| Fetch support ticket metadata | `GET` | `/api/v3/supportTicket?type=caseCustomFields` |


Both operations use the`/supportTicket`resource. The HTTP method and type query parameter determine the operation.

## Base URL

All API calls are sent to:

`https://api3.sprinklr.com/{env}/api/v3 `

The Support Ticket resource is:

`https://api3.sprinklr.com/{env}/api/v3/supportTicket `

Replace `{env}` with your assigned Sprinklr environment. See [APIs | Sprinklr Developer Portal](https://dev.sprinklr.com/apis) for the published environment list.
For the production environment at app.sprinklr.com, omit the {env} segment from the URL.

## Authentication & Headers

| Header | Value | Purpose | Required on |
|  --- | --- | --- | --- |
| `Authorization` | `Bearer {{accessToken}}` | Authenticates the user with the server | All requests |
| `Key` | `{{apiKey}}` | Authenticates the application with the server | All requests |
| `Content-Type` | `application/json` | Declares the request body media type | `POST` |
| `Accept` | `application/json` | Declares the acceptable response type | All requests |


The `Authorization`and `Key headers are required for all requests. Content-Type is required for POST requests.

For authentication and credential setup, see [API Overview](https://dev.sprinklr.com/api-overview) and [API Key and Secret Generation](https://dev.sprinklr.com/api-key-and-secret-generation) for registration and credential setup.

## Support Ticket Operations

### Create a support ticket

```
POST /api/v3/supportTicket
```

Creates a support ticket for the specified account.

**Request parameters**

| Parameter | Required | Type | Description |
|  --- | --- | --- | --- |
| `title` | Required | String | Subject of the case or issue |
| `email` | Required | String | Email address of the user, used for further communication |
| `accountId` | Required | Integer (`int64`) | Unique identifier of the account the case is created for |
| `description` | Optional | String | Description of the issue |
| `firstName` | Optional | String | First name of the user creating the case |
| `lastName` | Optional | String | Last name of the user creating the case |
| `fullName` | Optional | String | Full name of the user |
| `caseCustomProperties` | Optional | Object | Case-level custom field values |
| `messageCustomProperties` | Optional | Object | Message-level custom field values |


**Custom properties**

Use `caseCustomProperties` and `messageCustomProperties` to provide custom-field values.
Each property:

* Uses the custom-field id prefixed with `_c_` as the key.
* Accepts an array of strings as the value.
Example:


```json
"caseCustomProperties": {
  "_c_5cc9a7cfe4b01904c8dfc8f9": ["North America"],
  "_c_5cc9a7cfe4b01904c8dfc8fa": ["Priority customer"]
}
```

**Example Request**

```bash
curl --location 'https://api3.sprinklr.com/{env}/api/v3/supportTicket' \
  --header 'Authorization: Bearer {{accessToken}}' \
  --header 'Key: {{apiKey}}' \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --data-raw '{
    "title": "Unable to complete checkout",
    "description": "Customer reports a payment error at the final step.",
    "email": "jane.doe@example.com",
    "firstName": "Jane",
    "lastName": "Doe",
    "fullName": "Jane Doe",
    "caseCustomProperties": {
      "_c_5cc9a7cfe4b01904c8dfc8f9": [
        "North America"
      ]
    },
    "messageCustomProperties": {},
    "accountId": 600000000
  }'
```

**Example Response**

```json
{
  "data": {
    "id": "0000000000000000000000aa",
    "version": 0,
    "cType": "LIFE_EVENT",
    "sub": "#100000000 Email ",
    "piiMaskedSub": "#100000000 Email ",
    "cByUI": 60000000,
    "aUM": [],
    "cCMT": 1784567588577,
    "cCT": 1784567588573,
    "cMT": 1784567588577,
    "del": false,
    "uCW": {
      "que": [], "comm": [], "cProp": {}, "subs": [], "arc": false,
      "kbD": {}, "acl": {}, "aclM": {}, "clW": [], "surveyRespDets": {},
      "smRU": false, "smRP": false, "smRE": false, "smRV": false,
      "uSmResDets": [], "predSmResConf": [], "predFaqBotQues": [],
      "predFaqBotIntents": [], "predFaqBotThemes": [], "usedFaqBotQues": [],
      "usedFaqBotIntents": [], "usedFaqBotThemes": [], "nOCRU": 0, "tQD": {}
    },
    "caseNu": 100000000,
    "dCNu": "100000000",
    "sId": 600000000,
    "read": false
  },
  "errors": []
}
```

*Values shown are illustrative.*

**Reponse Parameters**

| **Parameter** | **Description** | **Type** |
|  --- | --- | --- |
| `id` | Case identifier | String |
| `version` | Record version | Integer |
| `cType` | Channel type | String |
| `sub` | Case subject | String |
| `piiMaskedSub` | Case subject with PII masked | String |
| `cByUI` | Id of the user that created the case | Integer |
| `aUM` | Associated universal messages | Array |
| `cCT` | Case creation time (epoch ms) | Integer |
| `cMT` | Case modification time (epoch ms) | Integer |
| `cCMT` | Case channel modification time (epoch ms) | Integer |
| `del` | Whether the case is deleted | Boolean |
| `uCW` | Case workflow object | Object |
| `caseNu` | Case number | Integer |
| `dCNu` | Case number for display | String |
| `sId` | Source id | Integer |
| `read` | Whether the case has been read | Boolean |


Use `dCNu` when your integration needs to store or display the case number.

### Fetch Case Custom Fields

```
GET /api/v3/supportTicket?type=caseCustomFields
```

Retrieves the case custom fields available in the workspace.

**Query Parameters**

| **Parameter** | **Required/Optional** | **Description** | **Type** |
|  --- | --- | --- | --- |
| `type` | Required | Type of metadata to retrieve. Use `caseCustomFields`. | String |


**Example Request**

```Shell
curl --location 'https://api3.sprinklr.com/{env}/api/v3/supportTicket?type=caseCustomFields' \
--header 'Authorization: Bearer {access-token}' \
--header 'Key: {api-key}' \
--header 'Accept: application/json'
```

**Example Response**

```JSON
{
  "data": {
    "entities": [
      {
        "id": "5cc9a7cfe4b01904c8dfc8f9",
        "fieldName": "5cc9a7cfe4b01904c8dfc8f5",
        "label": {
          "en": "Region"
        },
        "fieldType": "PICKLIST",
        "enabled": true,
        "required": false,
        "isHidden": false,
        "mandatoryForClosingTicket": false,
        "assetClassList": [
          "UNIVERSAL_CASE",
          "MESSAGE"
        ]
      }
    ],
    "count": 2669,
    "hasMore": true
  },
  "errors": []
}
```

The example response is abridged and uses illustrative values.

**Response Parameters**

| **Field** | **Type** | **Description** |
|  --- | --- | --- |
| `data.entities` | Array | Custom field definitions |
| `data.count` | Integer | Total number of custom fields available |
| `data.hasMore` | Boolean | Whether further custom fields exist beyond those returned |


**Custom field properties**

| **Field** | **Example** | **Description** |
|  --- | --- | --- |
| `id` | Unique custom-field identifier | String |
| `fieldName` | Field name | String |
| `label` | Display label by locale | Object |
| `fieldType` | Custom-field type | String |
| `enabled` | Indicates whether the field is enabled | Boolean |
| `required` | Indicates whether the field is required | Boolean |
| `isHidden` | Indicates whether the field is hidden | Boolean |
| `mandatoryForClosingTicket` | Indicates whether the field is required before closing the ticket | Boolean |
| `assetClassList` | Asset classes associated with the field | Array |


Use `id`, not `fieldName`, when constructing a custom-property key. Prefix the value with `_c_`.
For Example:

```
id = 5cc9a7cfe4b01904c8dfc8f9
```

becomes:

```
_c_5cc9a7cfe4b01904c8dfc8f9
```

For supported custom-field types, see Custom Fields.

## Response Format & Status Codes

### Response Envelope

Successful responses contain`data`and`errors`.

```JSON
{
  "data": {},
  "errors": []
}
```

Error responses use the standard V3 response structure:

```JSON
{
  "data": null,
  "errors": [
    {
      "id": "0000000000000000000000aa",
      "code": 400,
      "message": "account.not.found"
    }
  ],
  "metadata": {}
}
```

**Error Parameters**

| **Parameter** | **Decription** | **Type** |
|  --- | --- | --- |
| `id` | Error identifier | String |
| `code` | Numeric error code | String |
| `message` | Error Key | String |


## Response codes

| HTTP Code | Scenario | Description |
|  --- | --- | --- |
| `200` | Success | Operation completed successfully |
| `400` | Bad Request | The request was malformed or a required field was missing |
| `401` | Unauthorized | The access token is missing, invalid, or expired |
| `403` | Forbidden | The authenticated user lacks permission for the requested account |
| `404` | Not Found | Requested resource was not found |


## Migrating from V2 to V3

V3 consolidates support-ticket operations under the `/supportTicket` resource.

**Endpoint Mapping**

| Operation | V2 Endpoint | V3 Endpoint |
|  --- | --- | --- |
| Create a support ticket | `POST /api/v2/support-ticket/create-case` | `POST /api/v3/supportTicket` |
| Fetch case custom fields | `GET /api/v2/support-ticket/case-custom-fields` | `GET /api/v3/supportTicket?type=caseCustomFields` |


**Request Changes**

The create-ticket request fields remain unchanged in V3. Update the endpoint when migrating the create operation.

**Response Changes**

V3 places the response payload inside the data object.

For example:

```JavaScript
// V2
const caseNumber = response.dCNu;
 
// V3
const caseNumber = response.data.dCNu;
```

For custom fields:

```JavaScript
// V2
const fields = response.entities;
 
// V3
const fields = response.data.entities;
```

## Best Practices

* Include`title`,`email`, and`accountId`in every create-ticket request.
* Send custom-property values as arrays of strings.
* Use the field id, prefixed with `_c_`, for custom properties.
* Use `dCNu` when storing the display case number.
* Check`data.hasMore`when retrieving custom fields.
* Protect API credentials and do not store them in source code or application logs.


## Related

- [Support Ticket overview](https://legacy-dev.sprinklr.com/support-ticket)
- [Custom Fields](https://legacy-dev.sprinklr.com/custom-field)
- [API Overview](https://legacy-dev.sprinklr.com/api-overview)
- [API Key and Secret Generation](https://legacy-dev.sprinklr.com/api-key-and-secret-generation)