> ## 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.

# Get a service account

> Returns one service account by ID.



## OpenAPI

````yaml get /v1/service_accounts/{service_account_id}
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/{service_account_id}:
    parameters:
      - $ref: '#/components/parameters/service_account_id'
    get:
      summary: Gets a service account
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceAccountV1'
      x-codeSamples:
        - lang: bash
          source: >
            curl --request GET \

            --url
            https://api.baseten.co/v1/service_accounts/{service_account_id} \

            --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/{service_account_id}"


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


            response = requests.request(
                "GET",
                url,
                headers=headers,
                json={}
            )


            print(response.text)
components:
  parameters:
    service_account_id:
      schema:
        type: string
      name: service_account_id
      in: path
      required: true
  schemas:
    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
    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.

````