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

# List service accounts

> Lists the service accounts you administer.



## OpenAPI

````yaml get /v1/service_accounts
openapi: 3.1.0
info:
  description: REST API for management of Baseten resources
  title: Baseten management API
  version: 1.0.0
servers:
  - url: https://api.baseten.co
security:
  - BearerAuth: []
paths:
  /v1/service_accounts:
    get:
      summary: Lists service accounts
      description: >-
        Lists the service accounts you administer: every account for an
        organization admin, and your teams' accounts for a team admin. Workload
        identity federation tokens act as service accounts.
      parameters:
        - name: cursor
          in: query
          required: false
          description: >-
            Opaque cursor returned by a previous page. Omit to fetch the first
            page.
          schema:
            anyOf:
              - type: string
              - type: 'null'
            default: null
            title: Cursor
        - name: limit
          in: query
          required: false
          description: Maximum number of items to return.
          schema:
            default: 100
            maximum: 1000
            minimum: 1
            title: Limit
            type: integer
        - name: team_id
          in: query
          required: false
          description: Only this team's accounts
          schema:
            anyOf:
              - type: string
              - type: 'null'
            default: null
            title: Team Id
        - name: disabled
          in: query
          required: false
          description: Only disabled or enabled accounts
          schema:
            anyOf:
              - type: boolean
              - type: 'null'
            default: null
            title: Disabled
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceAccountsV1'
      x-codeSamples:
        - lang: bash
          source: |
            curl --request GET \
            --url https://api.baseten.co/v1/service_accounts \
            --header "Authorization: Bearer $BASETEN_API_KEY"
        - lang: python
          source: |-
            import requests
            import os
            API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
            url = "https://api.baseten.co/v1/service_accounts"

            headers = {"Authorization": f"Bearer {API_KEY}"}

            response = requests.request(
                "GET",
                url,
                headers=headers,
                params={'cursor': None, 'team_id': None, 'disabled': None}
            )

            print(response.text)
components:
  schemas:
    ServiceAccountsV1:
      description: A page of service accounts.
      properties:
        items:
          description: Items in this page.
          items:
            $ref: '#/components/schemas/ServiceAccountV1'
          title: Items
          type: array
        pagination:
          $ref: '#/components/schemas/PaginationResponseV1'
          description: Pagination metadata for the page.
      required:
        - items
        - pagination
      title: ServiceAccountsV1
      type: object
    ServiceAccountV1:
      description: A named service account that workload identity federation tokens act as.
      properties:
        id:
          description: Service account ID
          title: Id
          type: string
        name:
          description: Name, unique in the organization
          title: Name
          type: string
        description:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Description
          title: Description
        team_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: The team that owns the account. Null for an organization account.
          title: Team Id
        preset_permissions:
          $ref: '#/components/schemas/ServiceAccountPresetPermissionsV1'
          description: >-
            What the service account may do. Temporary; may be removed once
            fine-grained access control is available.
        disabled:
          description: Whether the account is disabled. A disabled account can't be used.
          title: Disabled
          type: boolean
        last_used_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          default: null
          description: >-
            Last time a token was exchanged for this account. Null until the
            first.
          title: Last Used At
        created_at:
          description: Time the account was created
          format: date-time
          title: Created At
          type: string
        updated_at:
          description: Time the account was last updated
          format: date-time
          title: Updated At
          type: string
      required:
        - id
        - name
        - preset_permissions
        - disabled
        - created_at
        - updated_at
      title: ServiceAccountV1
      type: object
    PaginationResponseV1:
      properties:
        has_more:
          description: Whether more items exist after this page.
          title: Has More
          type: boolean
        cursor:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            Opaque cursor to pass into the next request. Null when there is no
            next page.
          title: Cursor
      required:
        - has_more
      title: PaginationResponseV1
      type: object
    ServiceAccountPresetPermissionsV1:
      description: >-
        A service account's access: one of the access types API keys have.


        Temporary: mirrors API key access until fine-grained access control is
        available, and may be removed.
      properties:
        type:
          $ref: '#/components/schemas/ServiceAccountPresetTypeV1'
          description: >-
            What the service account may do. WORKSPACE_MANAGE_API_KEYS is for
            organization-level accounts only; every other type needs a team.
          examples:
            - WORKSPACE_MANAGE_ALL
        model_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          default: null
          description: >-
            WORKSPACE_INVOKE and WORKSPACE_EXPORT_METRICS only. Models the
            account covers. Omit for every model in the team, including models
            added later.
          examples:
            - - abcd1234
          title: Model Ids
        environment_names:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          default: null
          description: >-
            WORKSPACE_INVOKE: environments the account may call; omit for all.
            With model_ids, each model must have each environment.
            WORKSPACE_MANAGE_ALL: restricted environments the account may also
            manage.
          examples:
            - - production
          title: Environment Names
        model_api_slugs:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          default: null
          description: >-
            WORKSPACE_INVOKE_MODEL_APIS only. Model APIs the account may call;
            omit for all.
          examples:
            - - my-model-api
          title: Model Api Slugs
      required:
        - type
      title: ServiceAccountPresetPermissionsV1
      type: object
    ServiceAccountPresetTypeV1:
      description: >-
        What a service account may do: the workspace API key categories, plus
        Model APIs.


        Temporary: mirrors API key access until fine-grained access control is
        available, and may be removed.
      enum:
        - WORKSPACE_MANAGE_ALL
        - WORKSPACE_INVOKE
        - WORKSPACE_EXPORT_METRICS
        - WORKSPACE_MANAGE_API_KEYS
        - WORKSPACE_INVOKE_MODEL_APIS
      title: ServiceAccountPresetTypeV1
      type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send `Authorization: Bearer <api_key>`. The legacy `Authorization:
        Api-Key <api_key>` scheme is also accepted.

````