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

# Create a new service account.

> Create a service account. The `grant_type` decides which field applies:

- `org`: carries `capability_scopes`; a non-empty `project_grants` is
  rejected.
- `project`: carries `project_grants` (at most 50, each project once);
  a non-empty `capability_scopes` is rejected.

The applicable field may be empty or omitted. An account with no scopes or
grants can still authenticate, and its keys keep a small baseline of
organization-level access, such as reading server information, until
scopes or grants are added. To stop its keys from authenticating, disable
the account. The name must be unique within the organization.

Returns `400` if the request is invalid, including more than 50 project
grants or a project named more than once. Returns `404` if a project grant references a project not in the
caller's organization. Returns `409` if the name is already taken or the
organization has reached its service-account limit.




## OpenAPI

````yaml POST /v3/service-accounts
openapi: 3.0.3
info:
  title: Fiddler API - 2.0
  description: APIs to interact with Fiddler
  termsOfService: https://fiddler.ai/about/terms
  contact:
    email: support@fiddler.ai
  license:
    name: Proprietary
    url: '2.0'
  version: '2.0'
servers: []
security:
  - BearerAuth: []
tags:
  - name: agent-v3
    description: CRUD for the Agent Registry (Stage 1, manual entries)
  - name: aggregation-invalidation-request-v3
    description: Endpoints related to retrieving aggregation invalidation requests
  - name: alert-rules-v3
    description: CRUD for Alert Rules, Summary, and Stats APIs
  - name: application-v3
  - name: auth
    description: Authentication strategies and login flows
  - name: baseline-v3
    description: CRUD for baseline
  - name: catalog-v3
    description: >-
      Entity catalog provides paginated, searchable discovery of entity names
      (attribute keys, agent names, span types, span names, score names,
      evaluator config names) and their distinct values. Powered by ClickHouse
      materialized views — no worker or PostgreSQL dependency.
  - name: chart-annotation-v3
    description: Endpoints related to retrieving chart annotations
  - name: chart-v3
    description: CRUD for chart
  - name: queries-v3
    description: v3 queries API
  - name: configuration-v3
    description: >
      Read and change runtime configurations (Config Manager) for your
      organization, its projects, and its models.


      **Private preview.** These endpoints accept requests on every deployment.

      Whether a saved value takes effect depends on two deployment settings that
      are off by default:

      one makes Fiddler read stored values,

      and the other runs the configuration worker, which applies retention
      changes to stored data.

      Contact your Fiddler Customer Success Manager before using these
      endpoints.


      This reference documents the data retention (TTL) settings:

      `PROD_EVENTS_TTL_DAYS`, `GENAI_TRACES_TTL_DAYS`, and
      `GENAI_METRICS_TTL_DAYS`.

      The API accepts other registered settings too;

      contact your Fiddler Customer Success Manager before changing any of them.

      **Retention settings permanently delete data** once it is older than the
      configured period.

      When existing data is affected depends on the setting; see each setting's
      description.
  - name: cost-evaluators-v3
    description: >
      Paginated roll-up of per-evaluator LLM cost and token usage, aggregated
      hourly. Available only on deployments with evaluator cost reporting
      enabled.
  - name: cp-policy-v3
    description: >
      Configure Control Plane policies from policy packs, build them into signed
      revisions, and promote a revision so policy decision points evaluate it.
      These endpoints are served by the Control Plane policy administration
      service, and every one returns `404` while the policy engine is turned off
      for the deployment. Permissions come from the `Policy` authorization
      resource: Org Admins and Org Members hold `Policy: List` and `Policy:
      Read`, and only Org Admins hold `Policy: Create`, `Policy: Update` and
      `Policy: Delete`.
  - name: custom-metrics-v3
  - name: dimensionality-reduction-v3
  - name: environment-v3
    description: Endpoints related to environment management
  - name: evals
  - name: datasets
  - name: evaluation-v3
  - name: evaluator-v3
  - name: rule-evaluators-v3
  - name: experiment-v3
  - name: explainability-v3
  - name: llm_rca-v3
  - name: file-upload
    description: Endpoints related to file uploading.
  - name: fql-expressions-v3
    description: >
      Endpoints for listing FQL (Fiddler Query Language) functions available for
      GenAI custom metrics. Used by the frontend for autocomplete and signature
      hints in the FQL editor.
  - name: genai-alert-rules-v3
    description: CRUD API for GenAI Alert Rules
  - name: genai-custom-metrics-v3
    description: API for GenAI Custom Metrics
  - name: genai-filters-v3
    description: API for GenAI Filters
  - name: genai-metrics-v3
    description: >-
      Endpoints for pre-aggregated GenAI metrics. All metric data is
      pre-aggregated hourly by a Celery-based metric collector; no real-time
      aggregation is performed at request time.
  - name: guardrails-api
    description: Endpoints related to retrieving Guardrails specific data
  - name: ingestion-v3
  - name: intercom-api
    description: Endpoints related to intercom APIs
  - name: jobs-v3
  - name: llm-gateway-v3
  - name: auth-login
  - name: auth-logout
  - name: mcp-client-setup-v3
    description: Endpoints for retrieving MCP client setup instructions.
  - name: metrics-v3
    description: Metrics endpoints
  - name: model-v3
  - name: dashboard-v3
  - name: model-deployment-v3
  - name: monitoring-summary-v3
  - name: histograms-v3
  - name: organization-roles-v3
    description: Update user org role
  - name: organization-settings-v3
    description: Update organization settings such as timezone, email configuration, etc.
  - name: pagerduty-api
    description: CRUD for Pagerduty services.
  - name: project-v3
  - name: project-roles-v3
    description: Project role assignment management
  - name: scores-v3
    description: Unified CRUD for scores and annotations
  - name: searchable-text-key-v3
    description: >-
      Manage the global searchable text keys table that controls which OTel
      attribute keys are routed to the full-text-searchable `ValueContent`
      column in the unified attributes table. Changes propagate to the backing
      ClickHouse dictionary within 1-2 minutes and affect all tenants.
  - name: segments-v3
  - name: semantic-mapping-v3
    description: >-
      Manage the global semantic name mappings table that maps raw OTel
      attribute keys to canonical semantic concepts. Changes propagate to the
      backing ClickHouse dictionary within 1-2 minutes and affect all tenants.
  - name: server-info-v3
    description: Endpoints related to retrieving server information
  - name: service-account
    description: >
      Service accounts and their API keys. A human Org Admin manages the service
      accounts of their own organization: create, read, update, and
      enable/disable (there is no delete — an account is disabled instead), and
      issue, rename, enable/disable, and revoke each account's API keys (a key's
      expiry is fixed at creation and changed only by rotating the key). An API
      key is an `fks_` secret that inherits the account's grants and cannot
      manage service accounts; an active, unexpired key must be disabled before
      it can be revoked, and it authenticates only while both it and its account
      are active. Scopes here are capability scopes (what the account may do),
      not OAuth scopes. Fiddler also creates a service account for each model
      deployment; these accounts hold `models:artifact-read`, appear in lists,
      and are read-only: every write except disabling one returns `409`.
  - name: sessions-v3
    description: v3 session APIs
  - name: span-v3
  - name: team-roles-v3
  - name: team-v3
  - name: traces-v3
    description: v3 trace api for monitoring
  - name: fetch-sessions-v3
    description: v3 fetch sessions api for monitoring
  - name: user-access-key
    description: >
      CRUD operations for user API keys. All endpoints are user-scoped — each
      user can only operate on their own API keys. No one including Org admins
      have access to other users' API keys.
  - name: users-v3
  - name: version-compatibility-v3
  - name: webhooks
externalDocs:
  url: https://docs.fiddler.ai
  description: Find out more about Fiddler
paths:
  /v3/service-accounts:
    post:
      tags:
        - service-account
      summary: Create a new service account.
      description: >
        Create a service account. The `grant_type` decides which field applies:


        - `org`: carries `capability_scopes`; a non-empty `project_grants` is
          rejected.
        - `project`: carries `project_grants` (at most 50, each project once);
          a non-empty `capability_scopes` is rejected.

        The applicable field may be empty or omitted. An account with no scopes
        or

        grants can still authenticate, and its keys keep a small baseline of

        organization-level access, such as reading server information, until

        scopes or grants are added. To stop its keys from authenticating,
        disable

        the account. The name must be unique within the organization.


        Returns `400` if the request is invalid, including more than 50 project

        grants or a project named more than once. Returns `404` if a project
        grant references a project not in the

        caller's organization. Returns `409` if the name is already taken or the

        organization has reached its service-account limit.
      operationId: createServiceAccount
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceAccountCreateRequestBody'
      responses:
        '201':
          description: Service account created successfully.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ApiResponse'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/ServiceAccountSingleResponseBody'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
        '409':
          $ref: '#/components/responses/409'
        '500':
          $ref: '#/components/responses/500'
components:
  schemas:
    ServiceAccountCreateRequestBody:
      type: object
      description: >
        Only the field matching grant_type is accepted: capability_scopes for an
        org-scoped account, project_grants for a project-scoped account. The
        matching field may be empty or omitted. Unknown fields return a 400.
      required:
        - name
        - grant_type
      properties:
        name:
          $ref: '#/components/schemas/ServiceAccountName'
        description:
          type: string
          nullable: true
          maxLength: 512
          description: Optional free-text description.
        grant_type:
          $ref: '#/components/schemas/ServiceAccountGrantType'
        capability_scopes:
          type: array
          uniqueItems: true
          description: >
            Capability scopes for an org-scoped account. May be empty;
            duplicates are collapsed.
          items:
            $ref: '#/components/schemas/ServiceAccountCapabilityScope'
        project_grants:
          type: array
          maxItems: 50
          uniqueItems: true
          description: >
            Project-role grants for a project-scoped account. May be empty; each
            project may appear at most once, and an account may hold at most 50
            grants (a larger set returns 400).
          items:
            $ref: '#/components/schemas/ServiceAccountProjectGrant'
      additionalProperties: false
    ApiResponse:
      type: object
      description: |
        Response object for standard API responses.
      properties:
        api_version:
          type: string
          default: '3.0'
          enum:
            - '2.0'
            - '3.0'
          description: |
            API version.
        kind:
          type: string
          default: NORMAL
          enum:
            - NORMAL
          description: |
            Type of response, indicating a normal response.
    ServiceAccountSingleResponseBody:
      description: >
        A single service account, adding capability_scopes, project_grants, and
        the per-account key limit to the common fields.
      allOf:
        - $ref: '#/components/schemas/ServiceAccountBase'
        - type: object
          required:
            - capability_scopes
            - project_grants
            - max_api_keys_per_service_account
            - max_project_grants_per_service_account
          properties:
            capability_scopes:
              type: array
              nullable: true
              description: >
                Capability scopes for an org-scoped account, each with its
                human-readable description; an empty array if it has none.
                Always null for a project-scoped account — so null means
                "project account" and [] means "org account with no scopes".
              items:
                $ref: '#/components/schemas/ServiceAccountCapabilityScopeInfo'
            project_grants:
              type: array
              nullable: true
              description: >
                Project-role grants for a project-scoped account, each including
                the granted project's name; null for an org-scoped account.
              items:
                $ref: '#/components/schemas/ServiceAccountProjectGrantResponse'
            max_api_keys_per_service_account:
              type: integer
              description: >
                Maximum number of API keys this service account may hold.
                Compare against api_key_count to tell whether it is at capacity.
              example: 10
            max_project_grants_per_service_account:
              type: integer
              description: >
                Maximum number of project grants a project-scoped service
                account may hold. Compare against the length of project_grants
                to tell whether it is at capacity.
              example: 50
    ServiceAccountName:
      type: string
      description: >
        Service-account name, unique within the organization. Must start with a
        letter, then letters, digits, spaces, hyphens, or underscores. Leading
        and trailing whitespace is stripped.
      maxLength: 128
      minLength: 1
      pattern: ^[A-Za-z][A-Za-z0-9_ -]*$
    ServiceAccountGrantType:
      type: string
      description: >
        How the service account is scoped: to the whole organization (with
        capability scopes) or to specific projects (with project-role grants).
      enum:
        - org
        - project
    ServiceAccountCapabilityScope:
      type: string
      description: >
        A capability scope (not an OAuth scope) an org-scoped service account
        may hold. `models:artifact-read` is held only by the service account
        Fiddler manages for each model deployment and cannot be assigned by
        users.
      enum:
        - traces:ingest
        - models:artifact-read
        - guardrails:invoke
    ServiceAccountProjectGrant:
      type: object
      description: >
        A project-role grant for a project-scoped service account: the project
        to grant a role in (project_id) and the project role to assign
        (role_name). Used in create and update request bodies.
      required:
        - project_id
        - role_name
      properties:
        project_id:
          type: string
          format: uuid
          description: The uuid of the project to grant a role in.
        role_name:
          $ref: '#/components/schemas/ProjectRoleEnum'
      additionalProperties: false
    ServiceAccountBase:
      type: object
      description: >
        Service-account fields common to the list and single-account responses.
        Excludes capability_scopes and project_grants, which only the
        single-account responses carry.
      required:
        - id
        - name
        - grant_type
        - status
        - created_by
        - updated_by
        - created_at
        - updated_at
        - api_key_count
      properties:
        id:
          type: string
          format: uuid
          description: The service account's uuid.
        name:
          $ref: '#/components/schemas/ServiceAccountName'
        grant_type:
          $ref: '#/components/schemas/ServiceAccountGrantType'
        status:
          $ref: '#/components/schemas/ServiceAccountStatus'
        description:
          type: string
          nullable: true
          description: Free-text description, if set.
        created_by:
          $ref: '#/components/schemas/UserCompact'
        updated_by:
          $ref: '#/components/schemas/UserCompact'
        created_at:
          type: string
          format: date-time
          description: Timestamp when the account was created.
        updated_at:
          type: string
          format: date-time
          description: Timestamp when the account was last updated.
        api_key_count:
          type: integer
          description: >
            Number of API keys the account currently owns, including disabled
            and expired keys, until they are revoked.
          example: 0
    ServiceAccountCapabilityScopeInfo:
      type: object
      description: >
        A supported capability scope together with a human-readable description
        of what it allows.
      required:
        - name
        - description
      properties:
        name:
          $ref: '#/components/schemas/ServiceAccountCapabilityScope'
        description:
          type: string
          description: Human-readable description of what the scope allows.
          example: >-
            Send traces and spans to Fiddler from SDKs, gateways, and
            collectors.
      additionalProperties: false
    ServiceAccountProjectGrantResponse:
      type: object
      description: >
        A project-role grant as returned in a service-account response: the
        granted project (project_id and project_name) and the role assigned
        (role_name). project_name is included so the grant can be shown without
        a separate project lookup.
      required:
        - project_id
        - project_name
        - role_name
      properties:
        project_id:
          type: string
          format: uuid
          description: The uuid of the granted project.
        project_name:
          type: string
          description: The name of the granted project.
          example: fraud-detection
        role_name:
          $ref: '#/components/schemas/ProjectRoleEnum'
      additionalProperties: false
    ErrorResponse:
      type: object
      description: |
        Response object for errors returned by the API.
      properties:
        api_version:
          type: string
          default: '3.0'
          enum:
            - '2.0'
            - '3.0'
          description: |
            API version of the response.
        kind:
          type: string
          default: ERROR
          enum:
            - ERROR
          description: |
            Type of response, usually indicating an error.
        error:
          type: object
          properties:
            code:
              type: integer
              format: int32
              description: >
                Represents the code for this error, typically an HTTP response
                code.
              default: 400
              enum:
                - 400
                - 401
                - 403
                - 404
                - 409
                - 410
                - 422
                - 429
                - 500
                - 501
                - 503
            message:
              type: string
              description: >
                A human-readable message providing more details about the error.
                If there are multiple errors, it will be the message for the
                first error.
              example: Resource Not Found
            errors:
              type: array
              description: >
                Container for additional information regarding the error,
                especially for multiple errors.
              items:
                type: object
                properties:
                  reason:
                    type: string
                    description: >
                      Unique identifier for this error, different from the error
                      code.
                    example: ResourceNotFoundException
                  message:
                    type: string
                    description: >
                      A human-readable message providing more details about the
                      error. If there is only one error, this field will match
                      error.message.
                    example: Resource Not Found
                  help:
                    type: string
                    description: >
                      Link to support or documentation providing more
                      information on the error.
    ProjectRoleEnum:
      type: string
      description: >
        Defines the different types of project roles that can be assigned to
        users or teams.
      enum:
        - Project Admin
        - Project Writer
        - Project Viewer
        - Project Dashboard Viewer
    ServiceAccountStatus:
      type: string
      description: Lifecycle status of a service account.
      enum:
        - active
        - disabled
    UserCompact:
      type: object
      title: UserCompactV3
      description: >
        Compact version of a user which can be included in the response of
        relevant APIs.
      required:
        - id
        - email
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
          description: |
            Unique identifier for the user.
        full_name:
          type: string
          readOnly: true
          description: |
            Full name of the user.
        email:
          type: string
          format: email
          description: |
            Email address of the user.
  responses:
    '400':
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    '401':
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    '403':
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    '404':
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    '409':
      description: Conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    '500':
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````