---
title: "List organizations"
url: "https://developer-staging.agentsync.io/apis/platform-api/versions/8177e94d-86f2-48a5-8ed6-d5fbcb69f38a/operations/listOrganizations"
---

> Full API specification: https://developer-staging.agentsync.io/apis/platform-api/versions/8177e94d-86f2-48a5-8ed6-d5fbcb69f38a.md

# List organizations

`GET` `/v1/organizations`

Operation ID: `listOrganizations`

Lists the organizations your organization may see: your own organization, the counterparties on its active associations, and the organizations it controls through a live relationship. Your organization is always the one your token's service account belongs to; nothing in the request can name another. Your own organization comes first, then the counterparties, then the organizations it controls, and relationship says which each is. An organization that is both a counterparty and one your organization controls is listed once for each. A counterparty AgentSync holds no organization record for is left out, so an organization ID you see elsewhere, such as a contract's counterpartyOrganizationId, may not appear here. A page may hold fewer items than page_size, or none, while more remain: only page.nextToken says whether there are more pages.

## Query parameters

- `page_size` (integer, optional) - Items per page. Defaults to 50; a value above 50 is clamped to 50, since each organization on a page is read on its own. A non-numeric or non-positive value is a 400.
- `page_token` (string, optional) - Opaque token from a previous response's page.nextToken. Send it with the same filters as the request that returned it: it is signed for them. A token that is malformed, altered, sent with other filters, or longer than 1024 bytes is a 400.

## Responses

- `200` - One page of the organizations your organization may see.
- `400` - A parameter is missing, malformed or out of range (code parameter_invalid).
- `401` - The request has no bearer token, or the token is malformed, expired or wrongly signed (code token_invalid). Every /v1 path answers this without a valid token, including paths no route serves. The response carries WWW-Authenticate: Bearer.
- `403` - The token is valid but the API will not serve it. The code says why: caller_not_service_account (the token identifies a person; only service account tokens are accepted), caller_claims_missing (the token lacks a usable org_id or service_account_id claim), scope_missing (the token lacks the route's product scope, named in the details entry whose param is "scope"), or role_missing (the service account no longer holds a role at its organization that may call the route).
- `429` - Too many requests. A 429 written by the service carries the code rate_limit_exceeded; one written by the API gateway may have only a message and no details. Treat any 429 as rate limiting.
- `500` - The service failed in a way the caller cannot fix (code internal_error). A 500 written when the platform recovers from a panic has an empty body, and one written when a response cannot be encoded has a message and no details.
- `503` - A platform service this API depends on is unavailable (code service_unavailable).

## OpenAPI definition

```yaml
openapi: 3.1.1
info:
  title: AgentSync Platform API
  version: 0.0.1
servers:
  - url: https://api.{environment}.agentsync.io/platform
    description: AgentSync API gateway
    variables:
      environment:
        default: sandbox
        enum:
          - sandbox
paths:
  /v1/organizations:
    get:
      operationId: listOrganizations
      summary: List organizations
      description: "Lists the organizations your organization may see: your own
        organization, the counterparties on its active associations, and the
        organizations it controls through a live relationship. Your organization
        is always the one your token's service account belongs to; nothing in
        the request can name another. Your own organization comes first, then
        the counterparties, then the organizations it controls, and relationship
        says which each is. An organization that is both a counterparty and one
        your organization controls is listed once for each. A counterparty
        AgentSync holds no organization record for is left out, so an
        organization ID you see elsewhere, such as a contract's
        counterpartyOrganizationId, may not appear here. A page may hold fewer
        items than page_size, or none, while more remain: only page.nextToken
        says whether there are more pages."
      tags:
        - Organizations
      security:
        - oauth2:
            - platform.organizations.read
      parameters:
        - $ref: "#/components/parameters/OrganizationsPageSize"
        - $ref: "#/components/parameters/PageToken"
      responses:
        "200":
          description: One page of the organizations your organization may see.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OrganizationList"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooManyRequests"
        "500":
          $ref: "#/components/responses/InternalError"
        "503":
          $ref: "#/components/responses/ServiceUnavailable"
security:
  - oauth2:
      - platform.organizations.read
components:
  parameters:
    OrganizationsPageSize:
      name: page_size
      in: query
      description: Items per page. Defaults to 50; a value above 50 is clamped to 50,
        since each organization on a page is read on its own. A non-numeric or
        non-positive value is a 400.
      required: false
      schema:
        type: integer
        minimum: 1
        default: 50
      example: 25
    PageToken:
      name: page_token
      in: query
      description: "Opaque token from a previous response's page.nextToken. Send it
        with the same filters as the request that returned it: it is signed for
        them. A token that is malformed, altered, sent with other filters, or
        longer than 1024 bytes is a 400."
      required: false
      schema:
        type: string
      example: eyJrIjoiZXhhbXBsZSJ9
  schemas:
    OrganizationList:
      type: object
      description: "A page of the organizations your organization may see, one item
        per relationship an organization holds to yours: an organization that is
        both a counterparty and one yours controls appears twice, with the same
        id. Each item is read from the organization directory one at a time, so
        a page holds at most 50 items, fewer than the API-wide page size limit."
      required:
        - items
        - page
      properties:
        items:
          type: array
          description: The organizations on this page, your own first on the first page.
          maxItems: 50
          items:
            $ref: "#/components/schemas/Organization"
        page:
          $ref: "#/components/schemas/Page"
      example:
        items:
          - id: org_01h455vb4pex5vsknk084sn02q
            type: carrier
            legalName: Acme Life Insurance Company
            dbaNames:
              - Acme Life
            npn: null
            feinLastFour: "5678"
            parentId: null
            relationship: self
          - id: org_01m0tvmn2qe7p8ra1cyaabq8zh
            type: agency
            legalName: Northwind Agency LLC
            dbaNames: []
            npn: 1234567
            feinLastFour: null
            parentId: null
            relationship: counterparty
        page:
          nextToken: eyJrIjoib3JnYW5pemF0aW9ucyIsImMiOnsicyI6ImNvdW50ZXJwYXJ0aWVzIiwidCI6Im5leHQifX0
    Organization:
      type: object
      description: An organization your organization may see, and one way it stands to
        yours. An organization that stands to yours in more than one way is
        listed once for each, with the same id and a different relationship, so
        to count organizations, de-duplicate by id. Only the child item carries
        parentId, so items for the same organization can differ in it.
      required:
        - id
        - type
        - legalName
        - dbaNames
        - npn
        - feinLastFour
        - parentId
        - relationship
      properties:
        id:
          $ref: "#/components/schemas/OrganizationId"
        type:
          type: string
          description: "The kind of organization: carrier, carrier_group, agency, mga, mo
            or wholesale_broker. New kinds may be added, so treat a value you do
            not know as another kind of organization rather than an error."
          example: carrier
        legalName:
          type: string
          description: The organization's registered legal name.
          example: Acme Life Insurance Company
        dbaNames:
          type: array
          description: The names the organization does business as. Empty when it has none.
          items:
            type: string
            description: One name the organization does business as.
            example: Acme Life
          example:
            - Acme Life
        npn:
          type:
            - integer
            - "null"
          format: int64
          description: The organization's National Producer Number, for the kinds that
            hold one (agency, mga and mo). Null when it has none.
          example: 1234567
        feinLastFour:
          type:
            - string
            - "null"
          description: The last four digits of the organization's FEIN. The rest of the
            number is never served. Null when none is on file.
          pattern: ^[0-9]{4}$
          example: "5678"
        parentId:
          type:
            - string
            - "null"
          description: "The ID of the organization that controls this one, when that
            organization is yours: set on every organization whose relationship
            is child, and null on the others."
          pattern: ^org_[0-7][0-9a-hjkmnp-tv-z]{25}$
          example: org_01h455vb4pex5vsknk084sn02q
        relationship:
          $ref: "#/components/schemas/OrganizationRelationship"
      example:
        id: org_01kq0w4h7xf1e8t4zb2m5c6d7e
        type: agency
        legalName: Acme Captive Agency
        dbaNames: []
        npn: 1234567
        feinLastFour: "5678"
        parentId: org_01h455vb4pex5vsknk084sn02q
        relationship: child
    Page:
      type: object
      description: Pagination metadata of a collection response. nextToken is absent
        on the last page; pass it back as the page_token query parameter to
        continue.
      properties:
        nextToken:
          type: string
          description: Opaque token for the next page.
          example: eyJrIjoiZXhhbXBsZSJ9
      example:
        nextToken: eyJrIjoiZXhhbXBsZSJ9
    Error:
      type: object
      description: "The canonical error envelope. Every error the API writes carries a
        machine-readable code as the first details entry, the one whose param is
        \"code\"; branch on that, not on the message. There are two exceptions,
        both 500s the service could not build a normal error for: the platform's
        panic recovery writes an empty body, and a failure to encode a response
        writes {\"message\": \"internal server error\"} with no details. Treat a
        500 without a code as internal_error. A 429 from the API gateway, in
        front of the API, carries a message only; treat any 429 as a signal to
        slow down."
      required:
        - message
      properties:
        message:
          type: string
          description: Human-readable summary of why the request failed.
          example: invalid page_size
        details:
          type: array
          description: 'The code entry {"param": "code", "message": "<code>"} first, then
            entries that name the offending request parameter. Present on every
            error the service writes except the two code-less 500s described
            above, so it is not marked required.'
          items:
            $ref: "#/components/schemas/ErrorDetail"
      example:
        message: invalid page_size
        details:
          - param: code
            message: parameter_invalid
          - param: page_size
            message: must be a positive integer
    OrganizationId:
      type: string
      description: "An organization's ID: a TypeID with the prefix org. It never
        changes, and is the same ID for the organization across the AgentSync
        API."
      pattern: ^org_[0-7][0-9a-hjkmnp-tv-z]{25}$
      example: org_01h455vb4pex5vsknk084sn02q
    OrganizationRelationship:
      type: string
      description: "One way an organization stands to yours: self, counterparty or
        child. self is your own organization; counterparty is an organization on
        the other side of one of its active associations; child is an
        organization yours controls. An organization can hold more than one, and
        is then listed once for each. More values may be added as the
        organizations you may see widen, so treat a value you do not know as
        another relationship rather than an error."
      example: counterparty
    ErrorDetail:
      type: object
      description: "One entry of an error's details: the error code, or a request
        parameter and what is wrong with it."
      required:
        - param
        - message
      properties:
        param:
          type: string
          description: The parameter the entry is about, or "code" for the error code.
          example: code
        message:
          type: string
          description: For param "code", the error code; otherwise what is wrong with the
            parameter.
          example: parameter_invalid
      example:
        param: code
        message: parameter_invalid
  responses:
    BadRequest:
      description: A parameter is missing, malformed or out of range (code
        parameter_invalid).
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
          example:
            message: invalid page_size
            details:
              - param: code
                message: parameter_invalid
              - param: page_size
                message: must be a positive integer
    Unauthorized:
      description: "The request has no bearer token, or the token is malformed,
        expired or wrongly signed (code token_invalid). Every /v1 path answers
        this without a valid token, including paths no route serves. The
        response carries WWW-Authenticate: Bearer."
      headers:
        WWW-Authenticate:
          description: The authentication scheme the API expects.
          schema:
            type: string
          example: Bearer
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
          example:
            message: invalid or missing bearer token
            details:
              - param: code
                message: token_invalid
    Forbidden:
      description: "The token is valid but the API will not serve it. The code says
        why: caller_not_service_account (the token identifies a person; only
        service account tokens are accepted), caller_claims_missing (the token
        lacks a usable org_id or service_account_id claim), scope_missing (the
        token lacks the route's product scope, named in the details entry whose
        param is \"scope\"), or role_missing (the service account no longer
        holds a role at its organization that may call the route)."
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
          example:
            message: token lacks the required scope
            details:
              - param: code
                message: scope_missing
              - param: scope
                message: platform.contracts.read
    TooManyRequests:
      description: Too many requests. A 429 written by the service carries the code
        rate_limit_exceeded; one written by the API gateway may have only a
        message and no details. Treat any 429 as rate limiting.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
          example:
            message: rate limit exceeded
            details:
              - param: code
                message: rate_limit_exceeded
    InternalError:
      description: The service failed in a way the caller cannot fix (code
        internal_error). A 500 written when the platform recovers from a panic
        has an empty body, and one written when a response cannot be encoded has
        a message and no details.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
          example:
            message: internal server error
            details:
              - param: code
                message: internal_error
    ServiceUnavailable:
      description: A platform service this API depends on is unavailable (code
        service_unavailable).
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
          example:
            message: service unavailable
            details:
              - param: code
                message: service_unavailable
  securitySchemes:
    oauth2:
      type: oauth2
      description: "How to get the access token: the client-credentials flow, with the
        client ID and secret AgentSync issued for your organization. The token
        host follows the environment, auth.<environment>.agentsync.io. Request
        only the scopes your integration needs."
      flows:
        clientCredentials:
          tokenUrl: https://auth.sandbox.agentsync.io/oauth2/token
          scopes:
            platform.organizations.read: Read organizations.
            platform.contracts.read: Read contracts.
            platform.contract-assignments.read: Read contract assignments.
            platform.producers.read: Read producers.
            platform.tasks.read: Read tasks.
            platform.requirement-sets.read: Read requirement sets.
```
