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

# Create Credential

> Create a new credential.



## OpenAPI

````yaml api-reference/openapi.json post /api/v1/credentials
openapi: 3.1.0
info:
  title: FastAPI app
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/credentials:
    post:
      tags:
        - Credentials
      summary: Create Credential
      description: Create a new credential.
      operationId: create_credential_api_v1_credentials_post
      parameters:
        - name: X-Workspace-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: The workspace ID
            title: X-Workspace-Id
          description: The workspace ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CredentialCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CredentialRead'
        '404':
          description: Credential not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - DualAuthScheme: []
components:
  schemas:
    CredentialCreate:
      properties:
        label:
          type: string
          maxLength: 100
          minLength: 1
          title: Label
          description: Human-readable label for the credential
        description:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Description
          description: Optional description of the credential
        auth_type:
          $ref: '#/components/schemas/AuthType'
          description: Type of authentication (API_KEY, OAUTH2, etc.)
        credential_type:
          anyOf:
            - $ref: '#/components/schemas/CredentialType'
            - type: 'null'
          description: Category of credential (INTEGRATION, MODEL, etc.)
        credential_scope:
          type: string
          maxLength: 255
          title: Credential Scope
          description: Who is the credential for (workspace, user, workspace_member)
        provider:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Provider
          description: Provider of the credential
          default: custom
        user_id:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: User Id
          description: User ID of the credential
        credentials:
          additionalProperties: true
          type: object
          title: Credentials
          description: Raw credential data to be encrypted
      type: object
      required:
        - label
        - auth_type
        - credential_scope
        - credentials
      title: CredentialCreate
      description: Schema for creating a new credential.
    CredentialRead:
      properties:
        label:
          type: string
          maxLength: 100
          minLength: 1
          title: Label
          description: Human-readable label for the credential
        description:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Description
          description: Optional description of the credential
        auth_type:
          $ref: '#/components/schemas/AuthType'
          description: Type of authentication (API_KEY, OAUTH2, etc.)
        credential_type:
          anyOf:
            - $ref: '#/components/schemas/CredentialType'
            - type: 'null'
          description: Category of credential (INTEGRATION, MODEL, etc.)
        credential_scope:
          type: string
          maxLength: 255
          title: Credential Scope
          description: Who is the credential for (workspace, user, workspace_member)
        provider:
          type: string
          title: Provider
        user_id:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: User Id
          description: User ID of the credential
        id:
          type: string
          title: Id
        workspace_id:
          type: string
          title: Workspace Id
        created_by:
          type: string
          title: Created By
        status:
          type: string
          title: Status
        expires_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Expires At
        last_used_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Used At
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - label
        - auth_type
        - credential_scope
        - provider
        - id
        - workspace_id
        - created_by
        - status
        - created_at
        - updated_at
      title: CredentialRead
      description: Schema for reading credential data (without sensitive info).
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AuthType:
      type: string
      enum:
        - api_key
        - oauth_token
        - oauth_token_refresh
        - oauth_token_refresh_rotation
        - basic_auth
        - access_token
        - access_token_refresh
        - public_key_secret
        - connection_string
        - custom
      title: AuthType
    CredentialType:
      type: string
      enum:
        - integration
        - llm
        - storage
        - vector_store
        - auth_provider
        - custom
      title: CredentialType
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    DualAuthScheme:
      type: http
      scheme: bearer

````