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

# List blocked contacts

> List an account's blocked phone numbers, newest first.



## OpenAPI

````yaml GET /accounts/{account_id}/blocked_contacts
openapi: 3.1.1
info:
  title: Surge
  version: '1.0'
servers:
  - url: https://api.surge.app
security:
  - authorization: []
paths:
  /accounts/{account_id}/blocked_contacts:
    get:
      tags:
        - Blocked contacts
      summary: List blocked contacts
      description: >-
        Lists the account's blocked contacts, newest first, with cursor-based
        pagination.
      operationId: ListBlockedContacts
      parameters:
        - in: path
          name: account_id
          required: true
          schema:
            type: string
        - in: query
          name: after
          required: false
          schema:
            type: string
        - in: query
          name: before
          required: false
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockedContactList'
          description: List of blocked contacts
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Error
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Surge from '@surgeapi/node';


            const client = new Surge({
              apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
            });


            // Automatically fetches more pages as needed.

            for await (const blockedContact of
            client.blockedContacts.list('account_id')) {
              console.log(blockedContact.id);
            }
        - lang: Python
          source: |-
            import os
            from surge import Surge

            client = Surge(
                api_key=os.environ.get("SURGE_API_KEY"),  # This is the default and can be omitted
            )
            page = client.blocked_contacts.list(
                account_id="account_id",
            )
            page = page.data[0]
            print(page.id)
        - lang: Ruby
          source: |-
            require "surge_api"

            surge = SurgeAPI::Client.new(api_key: "My API Key")

            page = surge.blocked_contacts.list("account_id")

            puts(page)
components:
  schemas:
    BlockedContactList:
      title: BlockedContactList
      description: A paginated list of blocked contacts, newest first.
      properties:
        data:
          items:
            $ref: '#/components/schemas/BlockedContact'
          type: array
        pagination:
          $ref: '#/components/schemas/Pagination'
      required:
        - data
        - pagination
      type: object
    ErrorResponse:
      title: ErrorResponse
      description: An error response
      example:
        error:
          message: The requested resource could not be found.
          type: not_found
      properties:
        error:
          $ref: '#/components/schemas/Error'
      required:
        - error
      type: object
    BlockedContact:
      title: BlockedContact
      description: An account-level block on incoming communication from a phone number.
      properties:
        created_at:
          description: When the block was created.
          format: date-time
          type: string
        id:
          description: Unique identifier for the block.
          type: string
        phone_number:
          description: The blocked phone number in E.164 format.
          example: '+18015551234'
          format: phone-number
          pattern: ^\+[1-9]\d{6,14}$
          type: string
        reason:
          description: An optional explanation for the block.
          maxLength: 255
          type:
            - string
            - 'null'
      required:
        - id
        - phone_number
        - reason
        - created_at
      type: object
    Pagination:
      title: Pagination
      description: Cursor-based pagination information
      example:
        next_cursor: g3QAAAABZAACaWRtAAAAGnBuXzAxamtzY2s5eDdkeW0wZnBxZjdjYmRyeQ==
        previous_cursor: null
      properties:
        next_cursor:
          description: Cursor for the next page of results. Null if there is no next page.
          type:
            - string
            - 'null'
        previous_cursor:
          description: >-
            Cursor for the previous page of results. Null if there is no
            previous page.
          type:
            - string
            - 'null'
      type: object
    Error:
      title: Error
      description: An error response
      example:
        message: The requested resource was not found.
        type: not_found
      properties:
        detail:
          additionalProperties: true
          description: Additional details about the error.
          type: object
        message:
          description: A human-readable error message.
          example: The requested resource was not found.
          type: string
        type:
          description: A unique error code.
          example: not_found
          type: string
      required:
        - type
        - message
      type: object
  securitySchemes:
    authorization:
      bearerFormat: Surge API token
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.