> ## 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.

# Create Origin Rule



## OpenAPI

````yaml POST /api/v1/domains/{domain_id}/origin-rules
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/domains/{domain_id}/origin-rules:
    post:
      summary: Create Origin Rule
      operationId: create_origin_rule_api_v1_domains__domain_id__origin_rules_post
      parameters:
        - name: domain_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Domain Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OriginRuleCreateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OriginRuleResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
        - APIKeyHeader: []
components:
  schemas:
    OriginRuleCreateRequest:
      properties:
        target_subdomain:
          type: string
          title: Target Subdomain
          description: The tenant's target subdomain to route traffic to.
      type: object
      required:
        - target_subdomain
      title: OriginRuleCreateRequest
    OriginRuleResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        domain_id:
          type: string
          format: uuid
          title: Domain Id
        rule_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Rule Id
        status:
          $ref: '#/components/schemas/OriginRuleStatus'
        enabled:
          type: boolean
          title: Enabled
        rollback_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Rollback Data
      type: object
      required:
        - id
        - domain_id
        - rule_id
        - status
        - enabled
        - rollback_data
      title: OriginRuleResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    OriginRuleStatus:
      type: string
      enum:
        - pending
        - active
        - failed
      title: OriginRuleStatus
    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:
    HTTPBearer:
      type: http
      scheme: bearer
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````