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

# List connections



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/cerca/openapi.documented.yml get /connections
openapi: 3.1.0
info:
  description: API-key accessible routes for Cerca agents.
  title: Cerca API
  version: 0.0.0
servers:
  - url: https://api.cerca.dev
security:
  - bearerAuth: []
paths:
  /connections:
    get:
      tags:
        - Connections
      summary: List connections
      parameters:
        - schema:
            type: string
            enum:
              - organization
              - fleet
            description: Public connection owner type.
            example: fleet
          required: true
          description: Public connection owner type.
          name: ownerType
          in: query
        - schema:
            type: string
            description: Required when ownerType is fleet.
            example: fleet_abc123
          required: false
          description: Required when ownerType is fleet.
          name: fleetId
          in: query
        - schema:
            type: string
            description: Opaque pagination cursor returned by a previous request.
            example: cursor_abc123
          required: false
          description: Opaque pagination cursor returned by a previous request.
          name: cursor
          in: query
        - schema:
            type: string
            description: >-
              Maximum number of items to return. Defaults to 20 and preserves
              parseInt semantics.
            example: '20'
          required: false
          description: >-
            Maximum number of items to return. Defaults to 20 and preserves
            parseInt semantics.
          name: limit
          in: query
      responses:
        '200':
          description: Reusable connections for the requested owner.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicConnectionsPage'
        '400':
          description: Invalid request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Not authorized for this connection owner.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Requested connection owner or connection was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '415':
          description: Content-Type must be application/json.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        default:
          description: Error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Cerca from '@cerca-dev/sdk';


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


            // Automatically fetches more pages as needed.

            for await (const connection of client.connections.list({ ownerType:
            'fleet' })) {
              console.log(connection.id);
            }
        - lang: Python
          source: |-
            import os
            from cerca import Cerca

            client = Cerca(
                api_key=os.environ.get("CERCA_API_KEY"),  # This is the default and can be omitted
            )
            page = client.connections.list(
                owner_type="fleet",
            )
            page = page.connections[0]
            print(page.id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/matrices/cerca-go\"\n\t\"github.com/matrices/cerca-go/option\"\n)\n\nfunc main() {\n\tclient := cercago.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Connections.List(context.TODO(), cercago.ConnectionListParams{\n\t\tOwnerType: cercago.F(cercago.ConnectionListParamsOwnerTypeFleet),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n"
        - lang: Ruby
          source: |-
            require "cerca"

            cerca = Cerca::Client.new(api_key: "My API Key")

            page = cerca.connections.list(owner_type: :fleet)

            puts(page)
        - lang: CLI
          source: |-
            cerca connections list \
              --api-key 'My API Key' \
              --owner-type fleet
components:
  schemas:
    PublicConnectionsPage:
      type: object
      properties:
        connections:
          type: array
          items:
            $ref: '#/components/schemas/PublicConnectionSummary'
        cursor:
          type:
            - string
            - 'null'
        hasMore:
          type: boolean
      required:
        - connections
        - cursor
        - hasMore
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
          description: Stable machine-readable error code when the API can provide one.
          example: MONTHLY_TOKEN_BUDGET_EXCEEDED
      required:
        - error
    PublicConnectionSummary:
      type: object
      properties:
        accountLabel:
          type:
            - string
            - 'null'
        createdAt:
          type: string
        id:
          type: string
          format: uuid
        owner:
          $ref: '#/components/schemas/ConnectionOwner'
        provider:
          $ref: '#/components/schemas/CredentialProvider'
        scopes:
          type: array
          items:
            type: string
        type:
          $ref: '#/components/schemas/CredentialType'
        updatedAt:
          type: string
      required:
        - accountLabel
        - createdAt
        - id
        - owner
        - provider
        - scopes
        - type
        - updatedAt
    ConnectionOwner:
      oneOf:
        - type: object
          properties:
            type:
              type: string
              enum:
                - organization
              x-stainless-const: true
          required:
            - type
          additionalProperties: false
          title: OrganizationConnectionOwner
          x-stainless-variantName: OrganizationConnectionOwner
        - type: object
          properties:
            fleetId:
              type: string
              example: fleet_abc123
            type:
              type: string
              enum:
                - fleet
              x-stainless-const: true
          required:
            - fleetId
            - type
          additionalProperties: false
          title: FleetConnectionOwner
          x-stainless-variantName: FleetConnectionOwner
      description: >-
        Public owner for a reusable connection. Organization owners use the
        authenticated organization; fleet owners add a fleetId.
      discriminator:
        propertyName: type
    CredentialProvider:
      type: string
      enum:
        - google
        - github
        - slack
        - linear
        - notion
        - custom
        - webhook
    CredentialType:
      type: string
      enum:
        - oauth
        - api_key
  securitySchemes:
    bearerAuth:
      bearerFormat: Cerca API key
      scheme: bearer
      type: http

````