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

# Check User Tickets

> Check how many open tickets a user has

<Warning>
  **Requires Premium or Enterprise subscription**
</Warning>

## Overview

Check how many open tickets a user has in a specific category. Useful for enforcing ticket limits before allowing new ticket creation.

**Use this endpoint before calling `POST /tickets/create`** to check if the user has reached their category's maximum open tickets limit. If `CanCreateTicket` is `false`, inform the user they need to close existing tickets first.

## Path Parameters

<ParamField path="userId" type="string" required>
  UserId to check
</ParamField>

## Query Parameters

<ParamField query="category" type="string">
  Category ID to check (optional). If provided, returns category-specific limits.
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Whether the request was successful
</ResponseField>

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="UserId" type="integer">
      The checked user's ID
    </ResponseField>

    <ResponseField name="OpenTicketsCount" type="integer">
      Number of open tickets
    </ResponseField>

    <ResponseField name="CategoryLimit" type="integer">
      Maximum allowed tickets for the category (0 if no category specified)
    </ResponseField>

    <ResponseField name="CanCreateTicket" type="boolean">
      Whether the user can create more tickets
    </ResponseField>

    <ResponseField name="TicketsEnabled" type="boolean">
      Whether tickets module is enabled
    </ResponseField>
  </Expandable>
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  # Check all open tickets for user
  curl -X GET "https://api.series.hr/tickets/check-user-tickets/123456789" \
    -H "apikey: YOUR_API_KEY"

  # Check open tickets in specific category
  curl -X GET "https://api.series.hr/tickets/check-user-tickets/123456789?category=support" \
    -H "apikey: YOUR_API_KEY"
  ```

  ```typescript TypeScript theme={null}
  const response = await fetch('https://api.series.hr/tickets/check-user-tickets/123456789?category=support', {
    headers: {
      'apikey': 'YOUR_API_KEY'
    }
  });

  const data = await response.json();
  ```

  ```lua Lua (Roblox) theme={null}
  local HttpService = game:GetService("HttpService")

  local response = HttpService:RequestAsync({
      Url = "https://api.series.hr/tickets/check-user-tickets/123456789?category=support",
      Method = "GET",
      Headers = {
          ["apikey"] = "YOUR_API_KEY"
      }
  })

  local data = HttpService:JSONDecode(response.Body)
  ```

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

  response = requests.get(
      'https://api.series.hr/tickets/check-user-tickets/123456789?category=support',
      headers={'apikey': 'YOUR_API_KEY'}
  )

  data = response.json()
  ```
</CodeGroup>

## Response Example

```json theme={null}
{
  "success": true,
  "data": {
    "UserId": 123456789,
    "OpenTicketsCount": 2,
    "CategoryLimit": 5,
    "CanCreateTicket": true,
    "TicketsEnabled": true
  }
}
```

## Error Responses

<AccordionGroup>
  <Accordion title="400 - Invalid UserId">
    ```json theme={null}
    {
      "success": false,
      "error": {
        "code": 400,
        "message": "Invalid userId"
      }
    }
    ```
  </Accordion>

  <Accordion title="401 - API Key Required">
    ```json theme={null}
    {
      "success": false,
      "error": {
        "code": 401,
        "message": "API key is required"
      }
    }
    ```
  </Accordion>
</AccordionGroup>

## Rate Limit

**25 requests per second** per API key


## OpenAPI

````yaml GET /tickets/check-user-tickets/{userId}
openapi: 3.0.0
info:
  title: Series API
  version: 1.0.0
  description: >-
    Series API — a free REST API by Sailboat Games, LLC that lets Roblox
    communities programmatically manage workspaces, staff, sessions, time-off
    and activity data.
  contact:
    name: Sailboat Games, LLC.
    email: admin@sailboatgames.com
servers:
  - url: https://api.series.hr
    description: Production API
security:
  - ApiKeyAuth: []
paths:
  /tickets/check-user-tickets/{userId}:
    get:
      tags:
        - Tickets
      summary: Check user tickets
      description: >-
        Check how many open tickets a user has in a specific category. Requires
        Premium or Enterprise subscription.
      parameters:
        - name: userId
          in: path
          required: true
          schema:
            type: string
          description: UserId to check
        - name: category
          in: query
          schema:
            type: string
          description: Category ID to check
      responses:
        '200':
          description: Ticket count returned successfully
        '400':
          description: Invalid userId
        '401':
          description: API key is required
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: apikey
      description: >-
        Pass your API key in the `apikey` header. Alternatively, the `x-api-key`
        header is also accepted.

````