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

# Create a new mDoc credential template. Can be created from scratch or from a preset (v1)



## OpenAPI

````yaml products/didx-me/api-reference/v1/me-creds.json post /v1/templates/credentials/mdoc
openapi: 3.0.0
info:
  version: 1.0.0
  title: Me Creds API
  description: >2-

          
    OpenAPI documentation for Me Creds API

          
    Following JSON:API spec https://jsonapi.org/format/ approach to response
    payload format.


    **Unversioned endpoints are deprecated.**

          
     - [JSON - OpenAPI Specification](/me-creds/api/openapi.json)
servers:
  - url: https://test.didxtech.com/me-creds/api
security:
  - bearerAuth: []
tags:
  - name: issuances
    description: >-
      Create and track credential issuance offers. Each issuance represents an
      OID4VCI offer/exchange session. Replaces the legacy `POST
      /credentials/issuance`, `GET /credentials`, and `GET /credentials/{id}`
      endpoints with resources keyed by issuance session ID.
  - name: credentials
    description: >-
      Query and revoke issued credentials. Each credential is a flat issued
      artifact identified by its own credential ID (not the issuance session
      ID). Replaces the legacy `POST /credentials/{id}/revoke` and `POST
      /credentials/revoke` endpoints.
  - name: legacy credentials
    description: >-
      **Deprecated.** These endpoints conflate issuance sessions and issued
      credentials under a single `/credentials` path with inconsistent ID
      semantics. Use the `issuances` and `credentials` groups instead.
  - name: presentations
    description: >-
      Create and query presentation requests. The `/v1/` paths are identical
      mirrors of the deprecated unversioned endpoints — no behavior change.
  - name: templates
    description: >-
      Manage credential and presentation templates. The `/v1/` paths are
      identical mirrors of the deprecated unversioned endpoints — no behavior
      change.
  - name: presets
    description: >-
      Manage credential and presentation presets. The `/v1/` paths are identical
      mirrors of the deprecated unversioned endpoints — no behavior change.
  - name: endpoints
    description: >-
      Manage webhook endpoint destinations. The `/v1/` paths are identical
      mirrors of the deprecated unversioned endpoints — no behavior change.
  - name: trusted-entities
    description: >-
      Manage trusted entities for credential verification. The `/v1/` paths are
      identical mirrors of the deprecated unversioned endpoints — no behavior
      change.
  - name: certificate-signing-requests
    description: >-
      Manage certificate signing requests (CSRs). The `/v1/` paths are identical
      mirrors of the deprecated unversioned endpoints — no behavior change.
  - name: certificates
    description: >-
      Manage root certificates and their lifecycle. The `/v1/` paths are
      identical mirrors of the deprecated unversioned endpoints — no behavior
      change.
  - name: ecosystem-subscriptions
    description: >-
      Manage trust ecosystem subscriptions. The `/v1/` paths are identical
      mirrors of the deprecated unversioned endpoints — no behavior change.
paths:
  /v1/templates/credentials/mdoc:
    post:
      tags:
        - templates
      summary: >-
        Create a new mDoc credential template. Can be created from scratch or
        from a preset.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMdocCredentialTemplateRequestSchema'
      responses:
        '200':
          description: Created mDoc credential template.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MdocTemplateApiResponse'
        '400':
          description: Bad request - preset is not an mDoc preset.
        '404':
          description: Credential preset not found (for preset-based creation).
components:
  schemas:
    CreateMdocCredentialTemplateRequestSchema:
      oneOf:
        - $ref: '#/components/schemas/CreateFromPresetRequest'
        - $ref: '#/components/schemas/CreateMdocCredentialTemplateRequest'
      discriminator:
        propertyName: credentialFormat
        mapping:
          preset:
            $ref: '#/components/schemas/CreateFromPresetRequest'
          mdoc:
            $ref: '#/components/schemas/CreateMdocCredentialTemplateRequest'
    MdocTemplateApiResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/MdocTemplateDto'
        links:
          $ref: '#/components/schemas/ApiLinks'
        meta:
          $ref: '#/components/schemas/ApiMeta'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ApiError'
      required:
        - data
    CreateFromPresetRequest:
      type: object
      properties:
        credentialFormat:
          type: string
          enum:
            - preset
        presetId:
          type: string
      required:
        - credentialFormat
        - presetId
      additionalProperties: false
      example:
        credentialFormat: preset
        presetId: didx:basic-identity
    CreateMdocCredentialTemplateRequest:
      type: object
      properties:
        credentialFormat:
          type: string
          enum:
            - mdoc
        name:
          type: string
          minLength: 1
        description:
          type: string
        type:
          type: string
          minLength: 1
        templateAttributes:
          type: object
          additionalProperties:
            type: object
            properties:
              properties:
                type: object
                additionalProperties:
                  $ref: '#/components/schemas/MdocCredentialAttribute'
            required:
              - properties
        validUntil:
          type: object
          properties:
            future:
              type: object
              properties:
                days:
                  type: integer
                  minimum: 0
                months:
                  type: integer
                  minimum: 0
                years:
                  type: integer
                  minimum: 0
          required:
            - future
        issuerConfig:
          type: object
          properties:
            signer:
              type: string
              enum:
                - certificate
            keyType:
              type: string
              enum:
                - P-256
                - Ed25519
          required:
            - signer
        branding:
          $ref: '#/components/schemas/TemplateBranding'
      required:
        - credentialFormat
        - name
        - description
        - type
        - templateAttributes
        - validUntil
      example:
        credentialFormat: mdoc
        name: National ID
        description: South African national identity document
        type: za.co.didx.national-id
        templateAttributes:
          za.co.didx:
            properties:
              firstName:
                type: string
                name: First Name
                required: true
              dateOfBirth:
                type: date
                name: Date of Birth
                required: true
              address:
                type: object
                name: Address
                properties:
                  street:
                    type: string
                    name: Street
                  city:
                    type: string
                    name: City
        validUntil:
          future:
            days: 365
        issuerConfig:
          signer: certificate
          keyType: P-256
    MdocTemplateDto:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        createdAt:
          type: string
        updatedAt:
          type: string
        archivedAt:
          type: string
          nullable: true
        id:
          type: string
        presetId:
          type: string
          nullable: true
        format:
          type: string
          enum:
            - mdoc
        type:
          type: string
        attributes:
          type: object
          additionalProperties:
            type: object
            properties:
              properties:
                type: object
                additionalProperties:
                  $ref: '#/components/schemas/MdocCredentialAttribute'
            required:
              - properties
        validUntil:
          type: object
          properties:
            future:
              type: object
              properties:
                days:
                  type: number
                months:
                  type: number
                years:
                  type: number
          required:
            - future
        issuer:
          type: object
          properties:
            signer:
              type: string
              enum:
                - certificate
            keyType:
              type: string
              enum:
                - P-256
                - Ed25519
          required:
            - signer
            - keyType
        branding:
          $ref: '#/components/schemas/TemplateBranding'
      required:
        - name
        - description
        - createdAt
        - updatedAt
        - archivedAt
        - id
        - format
        - type
        - attributes
        - validUntil
        - issuer
      example:
        name: National ID
        description: South African national identity document
        attributes:
          za.co.didx:
            properties:
              firstName:
                type: string
                name: First Name
                required: true
        createdAt: '2025-02-20T11:27:37.051Z'
        updatedAt: '2025-02-20T11:27:37.051Z'
        archivedAt: null
        format: mdoc
        id: 6421a8905c17830c188e2e30
        type: za.co.didx.national-id
        validUntil:
          future:
            days: 365
        issuer:
          signer: certificate
          keyType: P-256
    ApiLinks:
      type: object
      properties:
        self:
          type: string
          format: uri
        first:
          type: string
          format: uri
        last:
          type: string
          format: uri
        prev:
          type: string
          format: uri
        next:
          type: string
          format: uri
        related:
          type: string
          format: uri
    ApiMeta:
      type: object
      additionalProperties:
        nullable: true
    ApiError:
      type: object
      properties:
        id:
          type: string
        status:
          type: string
        code:
          type: string
        title:
          type: string
        detail:
          type: string
        source:
          type: object
          properties:
            pointer:
              type: string
            parameter:
              type: string
        meta:
          type: object
          additionalProperties:
            nullable: true
      required:
        - detail
    MdocCredentialAttribute:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        required:
          type: boolean
        type:
          type: string
          enum:
            - string
            - number
            - boolean
            - date
            - binary
            - object
            - array
        properties:
          type: object
          additionalProperties:
            nullable: true
        items:
          nullable: true
      required:
        - type
    TemplateBranding:
      type: object
      properties:
        backgroundColor:
          type: string
          pattern: ^#[0-9A-Fa-f]{6}$
          description: 'Card background colour as a 6-digit hex code (#RRGGBB), e.g. #0066CC'
        textColor:
          type: string
          pattern: ^#[0-9A-Fa-f]{6}$
          description: 'Card text colour as a 6-digit hex code (#RRGGBB), e.g. #FFFFFF'
        backgroundImageUrl:
          type: string
          format: uri
          description: URL of the card background image
      example:
        backgroundColor: '#0066CC'
        textColor: '#FFFFFF'
        backgroundImageUrl: https://example.com/bg.png
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````