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

# Create Credential

> Create a new credential for storing sensitive data like API keys, tokens, or other secrets.



## OpenAPI

````yaml https://api.dev-sgp.scale.com/openapi-versions/v5/openapi.json post /v5/credentials
openapi: 3.1.0
info:
  title: EGP API V5
  description: >-
    This is the parent API for all EGP APIs. If you are looking for the EGP API,
    please go to https://api.egp.scale.com/docs.
  contact:
    name: Scale Generative AI Platform
    url: https://scale.com/genai-platform
  version: 0.1.0
servers:
  - url: https://api.egp.scale.com
security: []
paths:
  /v5/credentials:
    post:
      tags:
        - Credentials
      summary: Create Credential
      description: >-
        Create a new credential for storing sensitive data like API keys,
        tokens, or other secrets.
      operationId: POST-V5-/v5/credentials
      parameters:
        - name: x-selected-account-id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Account ID Header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCredentialRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Credential'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    CreateCredentialRequest:
      properties:
        type:
          type: string
          minLength: 1
          title: Type
          description: 'Type of credential: key or json'
        name:
          type: string
          minLength: 1
          title: Name
          description: User-friendly name for the credential
        description:
          title: Description
          description: Optional description
          type: string
        payload:
          type: string
          minLength: 1
          format: password
          title: Payload
          description: The credential payload to be encrypted
          writeOnly: true
        credential_metadata:
          title: Credential Metadata
          description: Optional unencrypted credential_metadata
          additionalProperties: true
          type: object
      type: object
      required:
        - type
        - name
        - payload
      title: CreateCredentialRequest
    Credential:
      properties:
        id:
          type: string
          title: Id
        object:
          type: string
          title: Object
          default: credential
        created_by_user_id:
          title: Created By User Id
          type: string
        created_by_identity_type:
          title: Created By Identity Type
          type: string
        type:
          type: string
          title: Type
        name:
          type: string
          title: Name
        description:
          title: Description
          type: string
        credential_metadata:
          title: Credential Metadata
          additionalProperties: true
          type: object
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - id
        - created_by_user_id
        - created_by_identity_type
        - type
        - name
        - description
        - credential_metadata
        - created_at
        - updated_at
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          title: Error Type
          type: string
        input:
          title: Input
        ctx:
          type: object
          title: Context
          additionalProperties: true
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````