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

# Create a DNS credential

> Bearer token authentication; RBAC permission `credentials.write`. Creates the org-scoped credential a cluster's custom DNS zones reference by credential_name. The webhook provider url carries the DNS provider's token, so it is stored in Vault and never echoed.



## OpenAPI

````yaml https://platform.ankra.app/openapi.json post /api/v1/credentials/dns
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://platform.ankra.app
security: []
paths:
  /api/v1/credentials/dns:
    post:
      tags:
        - DNS Credentials API
      summary: Create a DNS credential
      description: >-
        Bearer token authentication; RBAC permission `credentials.write`.
        Creates the org-scoped credential a cluster's custom DNS zones reference
        by credential_name. The webhook provider url carries the DNS provider's
        token, so it is stored in Vault and never echoed.
      operationId: create_dns_credential_token
      parameters:
        - description: PAT organisation override.
          in: header
          name: x-ankra-organisation-id
          required: false
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DNSCredentialCreateRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DNSCredentialCreateResponse'
          description: Successful response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDetailError'
          description: Invalid request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDetailError'
          description: Unauthenticated
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDetailError'
          description: Permission or CSRF check failed
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDetailError'
          description: Resource not found
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Request validation failed
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDetailError'
          description: Provider or internal failure
      security:
        - BearerAuth: []
components:
  schemas:
    DNSCredentialCreateRequest:
      example:
        name: smartoptics-dns
        webhook_provider_url: https://dns.example.com/api/external-dns/<token>
      properties:
        name:
          type: string
        webhook_provider_url:
          description: >-
            The external-dns webhook provider endpoint for the zone. The
            provider token rides inside the url, so the value is stored in Vault
            and never returned.
          type: string
          writeOnly: true
      required:
        - name
        - webhook_provider_url
      type: object
    DNSCredentialCreateResponse:
      example:
        errors: []
        id: 00000000-0000-0000-0000-000000000001
        name: smartoptics-dns
        success: true
      properties:
        errors:
          items:
            additionalProperties: true
            properties: {}
            type: object
          type: array
        id:
          format: uuid
          type: string
        name:
          type: string
        success:
          type: boolean
      required:
        - success
        - id
        - name
        - errors
      type: object
    ContractDetailError:
      example:
        detail: Cluster not found
      properties:
        detail:
          oneOf:
            - type: string
            - additionalProperties: true
              properties: {}
              type: object
      required:
        - detail
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: PAT
      scheme: bearer
      type: http

````