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

# List Services

> List and filter the services in your broker account.

Returns a paginated list of services that belong to the authenticated broker.

The full endpoint is `GET /api/v1/services`. The request does not have a body.

## Filtering And Order

The API applies all specified filters before it applies `offset` and `limit`.

Without `modified_since`, the API sorts services by `created_date` in descending order. With `modified_since`, the API sorts by `last_modified` in ascending order. It then sorts equal timestamps by `service_number` in ascending order.

The `modified_since` boundary is inclusive. A service can occur in two polling responses when its `last_modified` value is equal to the boundary. Use `service_number` as the public record identifier when processing repeated results.

The `pagination.page` value is `floor(offset / limit) + 1`. For predictable page numbers, use an `offset` that is a multiple of `limit`.

## Errors

Error responses use `success: false` and an `error` object.

| HTTP status | Error code                 | Cause                                                                                       |
| ----------- | -------------------------- | ------------------------------------------------------------------------------------------- |
| `400`       | `invalid_parameter`        | `status` is not one of the four accepted values.                                            |
| `400`       | `invalid_parameter`        | `modified_since` is not a full ISO 8601 timestamp with a timezone.                          |
| `401`       | `authentication_failed`    | The Bearer token is missing, invalid, inactive, or expired.                                 |
| `403`       | `insufficient_permissions` | The key does not have `services:read` or `admin:full`.                                      |
| `403`       | `insufficient_permissions` | `include_credentials=true` is present, but the key does not have `admin:full`.              |
| `403`       | `insufficient_permissions` | The request IP address is not allowed for the key.                                          |
| `429`       | `rate_limit_exceeded`      | The key reached its rate limit. The `Retry-After` header contains the wait time in seconds. |
| `500`       | `server_error`             | The API could not get the services or could not complete the request.                       |


## OpenAPI

````yaml api/openapi.yaml GET /v1/services
openapi: 3.1.0
info:
  title: Broker API
  version: 1.0.0
  description: API for broker-scoped service, request, and report operations.
servers:
  - url: https://brokers.newyorkcityservers.com/api
    description: Broker Panel API
security:
  - bearerAuth: []
tags:
  - name: Authentication
  - name: Services
  - name: Requests
  - name: Reports
paths:
  /v1/services:
    get:
      tags:
        - Services
      summary: List Services
      description: >-
        Lists broker-owned services with offset pagination and optional filters.
        Requires `services:read` or `admin:full`; credentials additionally
        require `admin:full`.
      operationId: listServices
      parameters:
        - name: limit
          in: query
          description: Maximum rows returned; runtime clamps the value to 1–100.
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
        - name: offset
          in: query
          description: >-
            Number of matching rows to skip; runtime clamps negative values to
            zero.
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: status
          in: query
          schema:
            type: string
            enum:
              - active
              - pending
              - suspended
              - cancelled
        - name: search
          in: query
          description: >-
            Case-insensitive customer name/email search, or exact numeric
            service number.
          schema:
            type: string
        - name: modified_since
          in: query
          description: Inclusive full ISO 8601 timestamp with timezone.
          schema:
            type: string
            format: date-time
        - name: include_credentials
          in: query
          description: >-
            Set to true to include cached VPS credentials; requires
            `admin:full`.
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: Paginated service list.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    required:
                      - data
                      - pagination
                    properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/Service'
                      pagination:
                        $ref: '#/components/schemas/Pagination'
              example:
                success: true
                data:
                  - service_number: 1001
                    customer_name: Example Trading Ltd
                    customer_email: admin@example.com
                    customer_phone: +1-212-555-0100
                    plan: Standard VPS
                    service_status: active
                    created_date: '2026-04-01T09:30:00.000Z'
                    next_billing_date: '2026-05-01'
                    last_modified: '2026-04-12T14:22:33.000Z'
                    notes: null
                pagination:
                  page: 1
                  perPage: 20
                  total: 1
                  totalPages: 1
        '400':
          description: >-
            Code `invalid_parameter` for an invalid status or modified
            timestamp.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: invalid_parameter
                  message: >-
                    Invalid status. Must be one of: active, pending, suspended,
                    cancelled
                  details:
                    parameter: status
                    valid_values:
                      - active
                      - pending
                      - suspended
                      - cancelled
        '401':
          $ref: '#/components/responses/AuthenticationError'
        '403':
          $ref: '#/components/responses/PermissionError'
        '429':
          $ref: '#/components/responses/RateLimitError'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    SuccessEnvelope:
      type: object
      required:
        - success
      properties:
        success:
          type: boolean
          const: true
        message:
          type: string
        pagination:
          $ref: '#/components/schemas/Pagination'
    Service:
      type: object
      required:
        - service_number
        - customer_name
        - customer_email
        - customer_phone
        - plan
        - service_status
        - created_date
        - next_billing_date
        - last_modified
        - notes
      properties:
        service_number:
          type:
            - integer
            - 'null'
        customer_name:
          type: string
        customer_email:
          type: string
          format: email
        customer_phone:
          type:
            - string
            - 'null'
        plan:
          type: string
        service_status:
          type: string
          description: >-
            Stored service state. Common values are active, pending, suspended,
            cancelled, and terminated.
        created_date:
          type: string
          format: date-time
        next_billing_date:
          type:
            - string
            - 'null'
        last_modified:
          type: string
          format: date-time
        notes:
          type:
            - string
            - 'null'
        cancel_date:
          type:
            - string
            - 'null'
        cancellation_reason:
          type:
            - string
            - 'null'
        vps_ip:
          type:
            - string
            - 'null'
        vps_username:
          type:
            - string
            - 'null'
        vps_password:
          type:
            - string
            - 'null'
          writeOnly: false
          description: Sensitive cached service credential.
    Pagination:
      type: object
      required:
        - page
        - perPage
        - total
        - totalPages
      properties:
        page:
          type: integer
          minimum: 1
        perPage:
          type: integer
          minimum: 1
          maximum: 100
        total:
          type: integer
          minimum: 0
        totalPages:
          type: integer
          minimum: 0
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          const: false
        error:
          $ref: '#/components/schemas/Error'
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
        message:
          type: string
        details:
          type: object
          additionalProperties: true
  responses:
    AuthenticationError:
      description: >-
        Code `authentication_failed` for a missing, malformed, invalid,
        inactive, or expired API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: authentication_failed
              message: Invalid API key
    PermissionError:
      description: >-
        Code `insufficient_permissions` when the request IP is not whitelisted
        or a required scope is missing.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: insufficient_permissions
              message: IP address not whitelisted
    RateLimitError:
      description: Code `rate_limit_exceeded` when the API key exceeds its rate limit.
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
            minimum: 1
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: rate_limit_exceeded
              message: Rate limit exceeded
    ServerError:
      description: >-
        Code `server_error` when authentication or internal processing cannot
        complete.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: server_error
              message: Internal server error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: >-
        Send the API key in the Authorization bearer header. Production keys
        begin with `sk_live_`.

````