> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Case

> Create a new case record for tracking issues or requests

<Note>
  This endpoint requires authentication with `cases:write` permission.
</Note>

### Request Parameters

<ParamField body="caseName" type="string" required>
  The name or title of the case
</ParamField>

<ParamField body="description" type="string" required>
  Detailed description of the case or issue
</ParamField>

<ParamField body="caseNumber" type="string">
  Optional custom case number (auto-generated if not provided)
</ParamField>

<ParamField body="caseStatus" type="string" default="new">
  Initial status of the case. Options: `new`, `in_progress`, `resolved`, `closed`
</ParamField>

<ParamField body="priority" type="string" default="medium">
  Priority level. Options: `low`, `medium`, `high`, `urgent`
</ParamField>

<ParamField body="submitter" type="string" required>
  ID or name of the person submitting the case
</ParamField>

<ParamField body="resolver" type="string">
  ID or name of the assigned resolver (can be assigned later)
</ParamField>

### Response

<ResponseField name="id" type="string">
  Unique identifier for the newly created case
</ResponseField>

<ResponseField name="caseName" type="string">
  The name or title of the case
</ResponseField>

<ResponseField name="description" type="string">
  Detailed description of the case
</ResponseField>

<ResponseField name="caseNumber" type="string">
  Assigned case number
</ResponseField>

<ResponseField name="caseStatus" type="string">
  Current status of the case
</ResponseField>

<ResponseField name="priority" type="string">
  Priority level of the case
</ResponseField>

<ResponseField name="submitter" type="string">
  Submitter of the case
</ResponseField>

<ResponseField name="resolver" type="string">
  Assigned resolver (if any)
</ResponseField>

<ResponseField name="createdDate" type="string">
  Timestamp when the case was created
</ResponseField>

<ResponseField name="updatedDate" type="string">
  Timestamp when the case was last updated
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request POST 'https://api.stateset.com/v1/cases' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <token>' \
  --data-raw '{
      "caseName": "Network Connectivity Issue",
      "description": "Customer unable to connect to WiFi",
      "priority": "high",
      "submitter": "user_123"
  }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.stateset.com/v1/cases', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: JSON.stringify({
      caseName: 'Network Connectivity Issue',
      description: 'Customer unable to connect to WiFi',
      priority: 'high',
      submitter: 'user_123'
    })
  });
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.stateset.com/v1/cases',
      headers={
          'Content-Type': 'application/json',
          'Authorization': 'Bearer YOUR_API_KEY'
      },
      json={
          'caseName': 'Network Connectivity Issue',
          'description': 'Customer unable to connect to WiFi',
          'priority': 'high',
          'submitter': 'user_123'
      }
  )
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "id": "case_001",
    "caseName": "Network Connectivity Issue",
    "description": "Customer unable to connect to WiFi",
    "caseNumber": "CASE-20240101-001",
    "caseStatus": "new",
    "priority": "high",
    "submitter": "user_123",
    "resolver": null,
    "createdDate": "2024-01-01T12:00:00Z",
    "updatedDate": "2024-01-01T12:00:00Z"
  }
  ```

  ```json Error Response theme={null}
  {
    "success": false,
    "error": {
      "code": "VALIDATION_ERROR",
      "message": "Missing required field: caseName"
    }
  }
  ```
</ResponseExample>
