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

# List Phones

> Retrieve a list of phones, optionally filtered by agent ID.



## OpenAPI

````yaml /api-reference/openapi.json get /v1/phone/
openapi: 3.1.0
info:
  title: Diga API
  version: 0.1.0
servers:
  - url: https://api.diga.io
    description: Production
security: []
paths:
  /v1/phone/:
    get:
      tags:
        - Phones
      summary: List Phones
      description: Retrieve a list of phones, optionally filtered by agent ID.
      operationId: list_phones_v1_phone__get
      parameters:
        - name: after
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: After
        - name: before
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: Before
        - name: page
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
                minimum: 1
              - type: 'null'
            title: Page
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            default: 20
            title: Limit
        - name: order
          in: query
          required: false
          schema:
            enum:
              - asc
              - desc
            type: string
            default: desc
            title: Order
        - name: inbound_agent_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: Inbound Agent Id
        - name: outbound_agent_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: Outbound Agent Id
        - name: status
          in: query
          required: false
          schema:
            anyOf:
              - $ref: '#/components/schemas/PhoneRegisterStatus'
              - type: 'null'
            title: Status
        - name: start_assigned_at
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            title: Start Assigned At
        - name: end_assigned_at
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            title: End Assigned At
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PaginatedResponse_PhoneRegisterResponseSchema_
        '400':
          description: Not Valid Field
          content:
            application/json:
              example:
                status: error
                error_code: NOT_VALID_FIELD
                message: Invalid field value in query parameters
              schema:
                $ref: '#/components/schemas/ErrorResponseSchema'
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              example:
                status: error
                error_code: INTERNAL_SERVER_ERROR
                message: Missing required permissions
              schema:
                $ref: '#/components/schemas/ErrorResponseSchema'
        '422':
          description: Unprocessable entity - Invalid pagination
          content:
            application/json:
              example:
                status: error
                error_code: INVALID_PAGINATION_PARAMETERS
                message: Cannot specify both 'before' and 'after' parameters
              schema:
                $ref: '#/components/schemas/ErrorResponseSchema'
        '500':
          description: Internal Server Error
          content:
            application/json:
              example:
                status: error
                error_code: INTERNAL_SERVER_ERROR
                message: An internal server error occurred
              schema:
                $ref: '#/components/schemas/ErrorResponseSchema'
      security:
        - CustomHTTPBearer: []
components:
  schemas:
    PhoneRegisterStatus:
      type: string
      enum:
        - reserved
        - assigned
        - released
        - finished
      title: PhoneRegisterStatus
      description: >-
        Enum representing the status of a phone number register. The cycle is as
        follows:

        - RESERVED: The phone number is reserved for a certain amount of time
        before being assigned

        - ASSIGNED: The phone number is assigned to a company

        - RELEASED: The phone number is released from the company and is pending
        availability for purchase (30 days before it can be purchased again)

        - FINISHED: The phone register process is finished, and the phone number
        is available for purchase again. Once a phone number reaches this
        status, it cannot return to previous statuses.
    PaginatedResponse_PhoneRegisterResponseSchema_:
      properties:
        data:
          items:
            $ref: '#/components/schemas/PhoneRegisterResponseSchema'
          type: array
          title: Data
        first_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: First Id
        last_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Last Id
        has_more:
          type: boolean
          title: Has More
        current_page:
          anyOf:
            - type: integer
            - type: 'null'
          title: Current Page
        total_pages:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total Pages
      type: object
      required:
        - data
        - has_more
      title: PaginatedResponse[PhoneRegisterResponseSchema]
    ErrorResponseSchema:
      properties:
        status:
          type: string
          title: Status
          description: Status of the response, always 'error' for error responses
          default: error
        error_code:
          type: string
          title: Error Code
          description: Machine-readable error code in SCREAMING_SNAKE_CASE format
          examples:
            - PROJECT_NOT_FOUND
            - INVALID_EMAIL
            - UNAUTHORIZED_ROLE
        message:
          type: string
          title: Message
          description: Human-readable error message with details
          examples:
            - Project with id 550e8400-e29b-41d4-a716-446655440000 not found
            - The email invalid@email is not valid
            - Insufficient permissions to perform this action
      type: object
      required:
        - error_code
        - message
      title: ErrorResponseSchema
      description: Standard error response format for all API errors.
    PhoneRegisterResponseSchema:
      properties:
        id:
          type: string
          format: uuid
          title: Phone Register ID
          description: Unique identifier for the phone register record
        nickname:
          anyOf:
            - type: string
            - type: 'null'
          title: Nickname
          description: The nickname given to the phone number
        number:
          type: string
          format: phone
          title: Phone Number
          description: The phone number
        telephony_provider:
          $ref: '#/components/schemas/TelephonyProvider'
          title: Telephony Provider
          description: >-
            The telephony provider (NETELIP for purchased numbers, CUSTOM for
            imported numbers)
        status:
          $ref: '#/components/schemas/PhoneRegisterStatus'
          title: Status
          description: >-
            Current status of the phone register (RESERVED, ASSIGNED, RELEASED,
            FINISHED)
        released_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Released At
          description: The date and time when the phone was released
        scheduled_release_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Scheduled Release At
          description: >-
            The date and time when the phone is scheduled to be released. If
            set, the phone will be released at this time at the end of the
            billing period.
        assigned_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Assigned At
          description: The date and time when the phone was assigned
        inbound_agent_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Inbound Agent ID
          description: >-
            The unique identifier for the agent that will receive the call when
            this phone receives an inbound call
        outbound_agent_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Outbound Agent ID
          description: >-
            The unique identifier for the agent that will make the calls when
            using this phone to make outbound calls
      type: object
      required:
        - id
        - number
        - telephony_provider
        - status
      title: PhoneRegisterResponseSchema
    TelephonyProvider:
      type: string
      enum:
        - netelip
        - custom
      title: TelephonyProvider
  securitySchemes:
    CustomHTTPBearer:
      type: http
      scheme: bearer

````