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

# List upstreams



## OpenAPI

````yaml /reference/openapi.yaml get /upstreams
openapi: 3.1.0
info:
  title: pgw admin API
  version: 0.4.0
  description: |
    Manage a pgw tenant: its apps, upstreams, managed mode users, bindings,
    and push log.

    The API listens on `admin_listen`, `127.0.0.1:8080` by default, over plain
    HTTP. Every endpoint except `POST /bootstrap`, `POST /tls/reload`, and the
    register bans needs a tenant API key in the `Authorization` header. Those
    need the server's `PGW_BOOTSTRAP_TOKEN`. Request bodies are JSON objects
    of at most 1 MiB, or 16 MiB for `POST /config/sync`, and pgw rejects
    unknown fields. Responses are never cached.

    An unknown path gets `404`, and a method that the path doesn't serve gets
    `405` with an `Allow` header. Every `GET` endpoint also answers `HEAD`.
    An endpoint that needs an API key answers `500` when pgw can't check the
    key.

    The same listener also serves `GET /metrics`, `GET /healthz`, and
    `GET /readyz`, outside `/api/v1` and without authentication. The health
    checks and metrics pages describe them.
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
servers:
  - url: '{baseUrl}'
    description: Your pgw admin listener
    variables:
      baseUrl:
        default: http://127.0.0.1:8080/api/v1
        description: The address of admin_listen, followed by /api/v1.
  - url: http://localhost:8080/api/v1
    description: pgw on this computer
security:
  - apiKey: []
tags:
  - name: Tenant
    description: Create the first tenant and read the caller's tenant.
  - name: Apps
    description: Mobile and web apps and their push credentials.
  - name: Upstreams
    description: PBXs that pgw registers apps with.
  - name: Users
    description: >-
      SIP accounts that pgw checks itself and registers at the PBX in managed
      mode.
  - name: Bindings
    description: Devices registered through pgw.
  - name: Push events
    description: The log of push attempts.
  - name: TLS
    description: The certificate that pgw presents to apps.
  - name: Register bans
    description: >-
      Source addresses that pgw refuses REGISTERs from after too many refused
      credentials.
  - name: Config
    description: Export a tenant's configuration and make it match a snapshot.
paths:
  /upstreams:
    get:
      tags:
        - Upstreams
      summary: List upstreams
      operationId: listUpstreams
      responses:
        '200':
          description: The tenant's upstreams.
          content:
            application/json:
              schema:
                type: object
                required:
                  - items
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/Upstream'
              example:
                items:
                  - id: Ux9cT4mK7pLw2RvN5yQs8g
                    name: asterisk
                    host: pbx.example.com
                    domains:
                      - '*.example.com'
                    port: 5060
                    transport: udp
                    mode: passthrough
                    contact_strategy: path
                    max_expires: 3600
                    invite_source_cidrs:
                      - 203.0.113.10/32
                    strict_path: true
                    keepalive_seconds: 30
                    managed_registration: ''
                    user_source: pgw
                    app_auth: digest
                    created_at: '2026-11-02T08:30:00Z'
                  - id: Km3wQ8zT1nVr6YpL4xCs9A
                    name: Kamailio
                    host: sip.example.net
                    port: 5060
                    transport: udp
                    mode: managed
                    contact_strategy: masquerade
                    max_expires: 3600
                    invite_source_cidrs:
                      - 198.51.100.0/24
                    strict_path: true
                    keepalive_seconds: 30
                    managed_registration: ''
                    user_source: kamailio
                    kamailio:
                      driver: mysql
                      host: db.example.net
                      port: 3306
                      user: pgw_reader
                      database: kamailio
                      tls: verify
                      password_set: true
                      use_domain: true
                      subscriber_table: subscriber
                      username_column: username
                      domain_column: domain
                      password_column: password
                      ha1_column: ha1
                      domain_table: domain
                      domain_table_column: domain
                    app_auth: digest
                    created_at: '2026-11-02T08:32:00Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    Upstream:
      type: object
      required:
        - id
        - name
        - host
        - port
        - transport
        - mode
        - contact_strategy
        - max_expires
        - invite_source_cidrs
        - strict_path
        - keepalive_seconds
        - managed_registration
        - user_source
        - app_auth
        - created_at
      properties:
        id:
          type: string
        name:
          type: string
        host:
          type: string
        domains:
          type: array
          items:
            type: string
          description: The upstream's domains, sorted. Absent when it has none.
        port:
          type: integer
        transport:
          type: string
          enum:
            - udp
            - tcp
            - tls
          description: |
            pgw doesn't connect to PBXs over `tls`, so registrations to such an
            upstream fail. Change it to `udp` or `tcp`; until then, any other
            change gets 400.
        mode:
          type: string
          enum:
            - passthrough
            - managed
        contact_strategy:
          type: string
          enum:
            - path
            - masquerade
        max_expires:
          type: integer
        invite_source_cidrs:
          type: array
          items:
            type: string
        strict_path:
          type: boolean
        keepalive_seconds:
          type: integer
        realm:
          type: string
          description: The digest realm of a managed upstream. Absent when it is the host.
        managed_registration:
          type: string
          enum:
            - ''
            - per_user
            - per_device
          description: Empty when the upstream uses the gateway default.
        user_source:
          type: string
          enum:
            - pgw
            - kamailio
        kamailio:
          $ref: '#/components/schemas/Kamailio'
        app_auth:
          type: string
          enum:
            - digest
            - bearer
            - both
        bearer:
          $ref: '#/components/schemas/Bearer'
        created_at:
          type: string
          format: date-time
    Kamailio:
      type: object
      required:
        - driver
        - host
        - port
        - user
        - database
        - tls
        - password_set
        - use_domain
        - subscriber_table
        - username_column
        - domain_column
        - password_column
        - ha1_column
        - domain_table
        - domain_table_column
      properties:
        driver:
          type: string
          enum:
            - mysql
            - postgres
        host:
          type: string
        port:
          type: integer
        user:
          type: string
        database:
          type: string
        tls:
          type: string
          enum:
            - 'off'
            - require
            - verify
        password_set:
          type: boolean
          description: Whether pgw holds the database password. pgw never returns it.
        use_domain:
          type: boolean
        subscriber_table:
          type: string
        username_column:
          type: string
        domain_column:
          type: string
        password_column:
          type: string
        ha1_column:
          type: string
        domain_table:
          type: string
        domain_table_column:
          type: string
    Bearer:
      type: object
      required:
        - issuer
        - audience
        - jwks_url
      properties:
        issuer:
          type: string
        audience:
          type: string
        jwks_url:
          type: string
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: What went wrong. Never contains the values that you sent.
  responses:
    Unauthorized:
      description: The API key is missing or unknown.
      headers:
        WWW-Authenticate:
          schema:
            type: string
            const: Bearer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: missing or unknown API key
    InternalError:
      description: pgw failed to complete the request. The details are in pgw's log.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: internal error
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: The tenant API key that `POST /bootstrap` returned.

````

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