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

# Add a key to a service account

> You may want to capture the result of this as the key will never be shown again



## OpenAPI

````yaml post /org/{org}/serviceaccount/{name}/-addKey
openapi: 3.0.3
info:
  title: Control Plane Core API
  description: Copyright © 2023 Control Plane Corporation. All rights reserved.
  version: 1.0.0
servers:
  - url: https://api.cpln.io
    description: ''
security:
  - {}
  - serviceAccountKey: []
  - jwt: []
externalDocs:
  url: https://docs.controlplane.com/
  description: End-user documentation
paths:
  /org/{org}/serviceaccount/{name}/-addKey:
    post:
      tags:
        - serviceaccount
      summary: Add a key to a service account
      description: >-
        You may want to capture the result of this as the key will never be
        shown again
      parameters:
        - in: path
          name: org
          required: true
          schema:
            type: string
        - in: path
          name: name
          required: true
          schema:
            type: string
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/serviceaccount_key'
      responses:
        '200':
          description: Service account was created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serviceaccount_key'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '403':
          description: Access denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
components:
  schemas:
    serviceaccount_key:
      type: object
      properties:
        name:
          type: string
          readOnly: true
        created:
          type: string
          format: date-time
          readOnly: true
        key:
          type: string
          readOnly: true
        description:
          type: string
          maxLength: 250
      additionalProperties: false
    error:
      type: object
      properties:
        status:
          type: integer
        message:
          type: string
        code:
          type: string
        details:
          type: object
        id:
          type: string
      additionalProperties: false
  securitySchemes:
    serviceAccountKey:
      type: apiKey
      in: header
      name: Authorization
      description: Service account key can be used as API keys
    jwt:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: IDP-provided token

````