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

# Create service account

> Creates a service account for accessing data views. Only one service account per teamspace is allowed.



## OpenAPI

````yaml post /data-views/service-accounts
openapi: 3.0.3
info:
  version: 0.1.1
  title: Datagrid API
  description: Datagrid API
servers:
  - url: https://api.datagrid.com/v1
security:
  - BearerAuth: []
paths:
  /data-views/service-accounts:
    post:
      tags:
        - Data Views
      summary: Create service account
      description: >-
        Creates a service account for accessing data views. Only one service
        account per teamspace is allowed.
      operationId: DataViews.ServiceAccounts.createServiceAccount
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - type
                - name
              properties:
                name:
                  type: string
                  description: >-
                    The name of the service account. Your organization's domain
                    will be automatically prepended to the service account name.
                    The name must only include letters (a-z, A-Z), numbers
                    (0-9), and hyphens (-), and must be between 6 and 30
                    characters long.
                type:
                  type: string
                  enum:
                    - gcp
                  description: >-
                    The type of service account, currently only `gcp` is
                    supported.
      responses:
        '201':
          description: Successfully created service account
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceAccount'
        '429':
          description: >-
            Rate limit exceeded. The request has been throttled because the rate
            limit for this endpoint has been reached. Check the `Retry-After`
            response header and retry after the specified number of seconds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Datagrid from 'datagrid-ai';


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


            const serviceAccount = await
            client.dataViews.serviceAccounts.create({ name: 'name', type: 'gcp'
            });


            console.log(serviceAccount.id);
        - lang: Python
          source: |-
            import os
            from datagrid_ai import Datagrid

            client = Datagrid(
                api_key=os.environ.get("DATAGRID_API_KEY"),  # This is the default and can be omitted
            )
            service_account = client.data_views.service_accounts.create(
                name="name",
                type="gcp",
            )
            print(service_account.id)
components:
  schemas:
    ServiceAccount:
      type: object
      description: >-
        The `service_account` object represents a service account for accessing
        data views.
      required:
        - object
        - type
        - id
        - email
        - created_at
      properties:
        object:
          type: string
          enum:
            - service_account
          description: The object type, which is always `service_account`.
        type:
          type: string
          enum:
            - gcp
          description: The type of service account, currently only `gcp` is supported.
        id:
          type: string
          description: The service account identifier.
        email:
          type: string
          description: The email address of the service account.
        created_at:
          type: string
          format: date-time
          description: The ISO string for when the service account was created.
    RateLimitError:
      type: object
      description: >-
        Returned when the rate limit is exceeded. Rate limits are enforced per
        teamspace, endpoint path, and HTTP method over a 60-second sliding
        window. Each endpoint may have its own limit — check the
        X-RateLimit-Limit response header for the effective value.
      required:
        - error
        - message
        - retryable
        - status_code
      properties:
        status_code:
          type: integer
          description: The HTTP status code (429).
        statusCode:
          type: integer
          deprecated: true
          description: Deprecated. Use status_code instead.
        error:
          type: string
          enum:
            - rate_limit_exceeded
          description: The error code identifying this as a rate limit error.
        message:
          type: string
          description: A human-readable error message.
        mitigation:
          type: string
          description: Suggested action to resolve the error.
        retryable:
          type: boolean
          description: Whether the request can be retried after a delay.
        details:
          type: object
          properties:
            reason:
              type: string
              description: A detailed explanation of why the rate limit was exceeded.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````