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

# Create Gate

> Create an x402 payment gate session — returns HTTP 402 with payment instructions. The core API call for charging AI agents for content access.

<RequestExample>
  ```bash theme={null}
  curl -X POST https://xenarch.dev/v1/gates \
    -H "X-Site-Token: st_abc123..." \
    -H "Content-Type: application/json" \
    -d '{"url": "/premium-article", "detection_method": "ua_match"}'
  ```
</RequestExample>

<ResponseExample>
  ```json 402 theme={null}
  {
    "xenarch": true,
    "gate_id": "7f3a1b2c-9d4e-4a8b-b6f1-2c3d4e5f6a7b",
    "price_usd": "0.003",
    "splitter": "0xC6D3a6B6fcCD6319432CDB72819cf317E88662ae",
    "collector": "0xabc123...publisher_wallet",
    "network": "base",
    "asset": "USDC",
    "protocol": "x402",
    "verify_url": "https://xenarch.dev/v1/gates/7f3a1b2c.../verify",
    "expires": "2026-04-10T15:00:00Z"
  }
  ```
</ResponseExample>

## Notes

* Returns HTTP 402 (Payment Required), not 200
* `collector` is the publisher's payout wallet address
* `splitter` is the Xenarch splitter contract address on Base
* Gates expire after 30 minutes by default (`GATE_TTL_SECONDS`)
* Price is resolved from path-specific rules or site default
* Origin/Referer header must match the registered site domain


## OpenAPI

````yaml POST /v1/gates
openapi: 3.1.0
info:
  title: Xenarch Platform
  version: 0.1.0
servers: []
security: []
paths:
  /v1/gates:
    post:
      tags:
        - gates
      summary: Create Gate Endpoint
      description: Create a gate session requiring payment for content access.
      operationId: create_gate_endpoint_v1_gates_post
      parameters:
        - name: x-site-token
          in: header
          required: true
          schema:
            type: string
            title: X-Site-Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GateCreateRequest'
      responses:
        '402':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GateCreateResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    GateCreateRequest:
      properties:
        url:
          type: string
          title: Url
        detection_method:
          anyOf:
            - type: string
            - type: 'null'
          title: Detection Method
      type: object
      required:
        - url
      title: GateCreateRequest
    GateCreateResponse:
      properties:
        xenarch:
          type: boolean
          title: Xenarch
          default: true
        gate_id:
          type: string
          format: uuid
          title: Gate Id
        price_usd:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Price Usd
        splitter:
          type: string
          title: Splitter
        collector:
          type: string
          title: Collector
        network:
          type: string
          title: Network
        asset:
          type: string
          title: Asset
          default: USDC
        protocol:
          type: string
          title: Protocol
          default: x402
        verify_url:
          type: string
          title: Verify Url
        expires:
          type: string
          format: date-time
          title: Expires
      type: object
      required:
        - gate_id
        - price_usd
        - splitter
        - collector
        - network
        - verify_url
        - expires
      title: GateCreateResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````