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

# Purchase Domain

> Purchase a domain.

This is a billable action. Ensure you have sufficient funds in your account.
The domain will be registered with the provided contact information.



## OpenAPI

````yaml POST /api/v1/registrar/purchase
openapi: 3.1.0
info:
  title: Dotlet API
  description: >-
    The Dotlet API lets you search, register, and manage domains, configure DNS
    records, and embed domain purchasing flows in your own product.


    All endpoints are authenticated with an API key or bearer token, and all
    request and response bodies are JSON.
  version: 0.1.1
  contact:
    name: Dotlet Support
    url: https://dotlet.net/support
    email: support@dotlet.net
servers:
  - url: https://api.dotlet.net
    description: Production
security: []
tags:
  - name: Domains
    description: Search, price, register, renew, and manage domains.
  - name: Orders
    description: Create and track domain orders separately from immediate purchases.
  - name: DNS
    description: Manage DNS records for domains hosted with Dotlet.
  - name: Hosted Sessions
    description: Create embeddable, scoped sessions for end users in your own product.
paths:
  /api/v1/registrar/purchase:
    post:
      tags:
        - Domains
      summary: Purchase Domain
      description: >-
        Purchase a domain.


        This is a billable action. Ensure you have sufficient funds in your
        account.

        The domain will be registered with the provided contact information.
      operationId: purchase_domain_api_v1_registrar_purchase_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DomainPurchaseRequest'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainPurchaseResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
        - HTTPBearer: []
components:
  schemas:
    DomainPurchaseRequest:
      properties:
        domain:
          type: string
          maxLength: 255
          minLength: 1
          title: Domain
        years:
          type: integer
          maximum: 10
          minimum: 1
          title: Years
          default: 1
        contact:
          $ref: '#/components/schemas/RegistrantContactSchema'
        nameservers:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Nameservers
        privacy:
          type: boolean
          title: Privacy
          default: true
        auto_renew:
          type: boolean
          title: Auto Renew
          default: true
        registrar:
          type: string
          title: Registrar
          description: Registrar to use (currently only namecheap is supported)
          default: namecheap
        setup_dns:
          type: boolean
          title: Setup Dns
          description: Automatically setup DNS after purchase
          default: false
        dns_provider:
          type: string
          title: Dns Provider
          description: DNS provider to use for setup
          default: cloudflare
      type: object
      required:
        - domain
        - contact
      title: DomainPurchaseRequest
      description: Request to purchase a domain
    DomainPurchaseResponse:
      properties:
        success:
          type: boolean
          title: Success
        domain:
          type: string
          title: Domain
        order_id:
          type: string
          title: Order Id
        registrar_order_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Registrar Order Id
        registration_date:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Registration Date
        expiry_date:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Expiry Date
        nameservers:
          items:
            type: string
          type: array
          title: Nameservers
          default: []
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
        dns_setup:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Dns Setup
        status_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Status Url
      type: object
      required:
        - success
        - domain
        - order_id
      title: DomainPurchaseResponse
      description: Response for domain purchase
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    RegistrantContactSchema:
      properties:
        first_name:
          type: string
          maxLength: 100
          minLength: 1
          title: First Name
        last_name:
          type: string
          maxLength: 100
          minLength: 1
          title: Last Name
        email:
          type: string
          format: email
          title: Email
        phone:
          type: string
          maxLength: 20
          minLength: 10
          title: Phone
        address1:
          type: string
          maxLength: 255
          minLength: 1
          title: Address1
        city:
          type: string
          maxLength: 100
          minLength: 1
          title: City
        state:
          type: string
          maxLength: 100
          minLength: 1
          title: State
        postal_code:
          type: string
          maxLength: 20
          minLength: 1
          title: Postal Code
        country:
          type: string
          maxLength: 2
          minLength: 2
          title: Country
        organization:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Organization
        address2:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Address2
      type: object
      required:
        - first_name
        - last_name
        - email
        - phone
        - address1
        - city
        - state
        - postal_code
        - country
      title: RegistrantContactSchema
      description: Contact information for domain registration
    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:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
    HTTPBearer:
      type: http
      scheme: bearer

````