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

# Purchase Domain

> Start a domain purchase. Returns a Stripe checkout URL the account owner opens and pays in a browser. Domains are billed yearly and renew automatically. The domain registers only after payment clears, and failed registrations are refunded automatically. Requires an active paid Migma subscription (returns 409 otherwise) and an API key with domain:write permission.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/domains/purchase
openapi: 3.1.0
info:
  title: Migma.ai API (v1)
  description: >-
    API for managing brands, contacts, email generation, sending, and
    integrations.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.migma.ai
    description: Production
security:
  - apiKeyAuth: []
tags:
  - name: Projects/Brands
    description: Manage projects (brands) and import from websites
  - name: Contacts
    description: Manage your contacts, segments, tags, and topics
  - name: Segments
    description: Create and manage dynamic contact segments
  - name: Tags
    description: Organize contacts with tags
  - name: Topics
    description: Manage subscription topics and preferences
  - name: Emails
    description: Generate, send, and export emails
  - name: Email Validation
    description: Validate email content for compatibility and deliverability
  - name: Email Previews
    description: Preview emails across devices and email clients
  - name: Domains
    description: Manage sending domains and verification
  - name: Webhooks
    description: Manage webhook endpoints for real-time event notifications
  - name: Events
    description: Record customer events and conversions
  - name: Integrations
    description: Third-party platform integrations
  - name: Campaigns
    description: Create, schedule, send, and manage email campaigns
  - name: Billing
    description: View your plan and credits and create billing links
  - name: Project Editing
    description: Edit project assets, logos, images, and knowledge base entries
paths:
  /v1/domains/purchase:
    post:
      tags:
        - Domains
      summary: Purchase Domain
      description: >-
        Start a domain purchase. Returns a Stripe checkout URL the account owner
        opens and pays in a browser. Domains are billed yearly and renew
        automatically. The domain registers only after payment clears, and
        failed registrations are refunded automatically. Requires an active paid
        Migma subscription (returns 409 otherwise) and an API key with
        domain:write permission.
      operationId: PurchaseDomain
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PurchaseDomainRequest'
      responses:
        '200':
          description: Domain purchase started
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponseDomainPurchaseStarted'
              example:
                success: true
                data:
                  checkoutUrl: https://checkout.stripe.com/c/pay/cs_live_...
                  checkoutSessionId: cs_live_...
                  billingMode: annual_subscription
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
components:
  schemas:
    PurchaseDomainRequest:
      type: object
      required:
        - domain
      properties:
        domain:
          type: string
          minLength: 3
          maxLength: 253
          description: The domain to purchase, e.g. 'acme.com'
        redirectUrl:
          type: string
          format: uri
          description: Where to send the account owner after checkout completes
    ApiResponseDomainPurchaseStarted:
      allOf:
        - $ref: '#/components/schemas/ApiResponse'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/DomainPurchaseStarted'
    ApiResponse:
      type: object
      properties:
        success:
          type: boolean
        data:
          nullable: true
        error:
          type: string
          nullable: true
      required:
        - success
    DomainPurchaseStarted:
      type: object
      properties:
        checkoutUrl:
          type: string
          description: Stripe checkout URL the account owner opens and pays in a browser
        checkoutSessionId:
          type: string
          description: Stripe Checkout session id, when applicable
        stripeInvoiceId:
          type: string
          description: Stripe invoice id, when applicable
        stripeSubscriptionId:
          type: string
          description: Stripe subscription id, when applicable
        billingMode:
          type: string
          enum:
            - annual_subscription
          description: How the domain is billed. Domains renew yearly.
        updateApplied:
          type: boolean
          description: Whether the purchase was applied to an existing subscription
      required:
        - checkoutUrl
    ApiError:
      type: object
      properties:
        success:
          type: boolean
          default: false
        error:
          type: string
        code:
          type: string
          description: >-
            Machine-readable error code (e.g., IDEMPOTENCY_CONFLICT,
            DOMAIN_CLAIMABLE).
        data:
          type: object
          description: >-
            Additional structured context for the error, such as the affected
            domain.
          additionalProperties: true
      required:
        - success
        - error
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Forbidden:
      description: Forbidden - Missing required permissions or access denied
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Conflict:
      description: >-
        Conflict - the Idempotency-Key was reused with a different request body
        (code: IDEMPOTENCY_CONFLICT)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        API key authentication. Use 'Authorization: Bearer YOUR_API_KEY' where
        YOUR_API_KEY is obtained from the Migma dashboard under Settings →
        Developers → API Keys.

````