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

# Create Credential Type with Name

> Create or import a type with a given name. This is how you define a custom credential schema.

**API scope required** `credentials.create`


<Snippet file="alpha-api-note.mdx" />


## OpenAPI

````yaml put /v1-alpha1/credentials/types/{typeName}
openapi: 3.0.1
info:
  description: N/A
  version: 1.0.0
  title: Verifiable Credentials
  contact:
    name: Crossmint Verifiable Credentials APIs
    url: https://www.crossmint.com
    email: support@crossmint.com
servers:
  - url: https://staging.crossmint.com/api
    description: Staging environment (testnets)
  - url: https://www.crossmint.com/api
    description: Production environment (mainnets)
security:
  - apiKey: []
paths:
  /v1-alpha1/credentials/types/{typeName}:
    put:
      tags:
        - Verifiable Credentials
      summary: Create Credential Type with Name
      description: >
        Create or import a type with a given name. This is how you define a
        custom credential schema.


        **API scope required** `credentials.create`
      operationId: create-type-idempotent
      parameters:
        - name: typeName
          in: path
          description: The name of the type.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              anyOf:
                - title: Create Type
                  type: object
                  required:
                    - Create Type
                  properties:
                    $schema:
                      type: string
                      example: https://json-schema.org/draft/2020-12/schema
                    title:
                      type: string
                      example: Course completion
                    description:
                      type: string
                      example: Describes the course completed and the assigned grade
                    type:
                      type: string
                      example: object
                    properties:
                      type: object
                      properties:
                        credentialSubject:
                          type: object
                          example:
                            type: object
                            properties:
                              course:
                                type: string
                              grade:
                                type: string
                              id:
                                type: string
                            required:
                              - course
                              - grade
                            additionalProperties: false
                - title: Import Type
                  type: object
                  required:
                    - Import Type
                  properties:
                    $id:
                      type: string
                      description: URL for importing an existing type."
                      example: >-
                        https://raw.githubusercontent.com/decentralized-identity/credential-schemas/main/schemas/ExampleEntity/ExampleNameSchema.json
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatedType'
        '400':
          description: Bad Request
          content:
            error:
              examples:
                Recursion:
                  description: The type schema is recursive
                UnusedDeclaration:
                  description: The type schema has unused declarations
                UndefinedType:
                  description: The type schema references an undefined type
                BaseTypeOverridden:
                  description: The type schema overrides a base type
                MissingCredentialSubjectSchema:
                  description: The type schema is missing a credential subject schema
                AlreadyDefined:
                  description: A type with the given name already exists.
components:
  schemas:
    CreatedType:
      type: object
      properties:
        id:
          type: string
          example: >-
            crossmint:bfb292e7-2700-4924-9213-478f3d71f2d8:CourseCompletionCertificate
        typeSchema:
          type: object
          properties:
            $schema:
              type: string
              example: https://json-schema.org/draft/2020-12/schema
            title:
              type: string
              example: Course completion
            description:
              type: string
              example: Describes the course completed and the assigned grade
            type:
              type: string
              example: object
            properties:
              type: object
              properties:
                credentialSubject:
                  type: object
                  example:
                    type: object
                    properties:
                      course:
                        type: string
                      grade:
                        type: string
                      id:
                        type: string
                    required:
                      - course
                      - grade
                    additionalProperties: false
            $id:
              type: string
              example: >-
                https://staging.crossmint.com/api/v1-alpha1/credentials/types/crossmint:bfb292e7-2700-4924-9213-478f3d71f2d8:CourseCompletionCertificate
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-KEY
      description: >-
        Key obtained from the Crossmint developer console, reflecting the API
        scope granted.

````