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

# Create Order

> Place a CPL order.

Pricing is server-side: `price_per_fan` is computed from the offer plus your tier discount, so the caller does not set it.

We recommend running [`GET /cpl/orders/quote`](/api/cpl-orders-quote) first with the same body to preview cost and eligibility before committing.


## OpenAPI

````yaml POST /cpl/orders
openapi: 3.0.3
info:
  title: OnlyTraffic Studio API
  version: 1.0.0
  description: >-
    External API for OnlyTraffic Studio. Manage and retrieve data about your
    subscribers, CPL orders, and CPC orders.
servers:
  - url: https://studio-api.onlytraffic.com/api/external/v1
security:
  - ApiKeyAuth: []
tags:
  - name: Account
    description: API key holder's wallet, profile, and aggregate state.
  - name: Accounts
    description: OnlyFans accounts attached to the API key holder.
  - name: Agencies
    description: Agency CRUD and image management. All edits stage in moderation.
  - name: CPL
    description: >-
      Cost-per-lead orders: place, list, cancel, manage settings, browse partner
      offers.
  - name: CPC
    description: Cost-per-click orders and creative management.
  - name: RevShare
    description: Revenue-share campaigns and invoices.
  - name: Swaps
    description: Two-sided traffic swap orders and offers.
  - name: Subscribers
    description: Per-fan delivery feed (cursor-paginated).
  - name: Transactions
    description: Per-transaction OF revenue feed (cursor-paginated).
paths:
  /cpl/orders:
    post:
      tags:
        - CPL
      summary: Create a CPL order.
      description: Place a CPL order.
      operationId: createCplOrder
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CplOrderCreateRequest'
      responses:
        '201':
          description: Created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      order_id:
                        type: string
                        example: cplo_xxxxxxx
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: Insufficient balance.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Offer or OF account not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: >-
            Validation failed (terms not approved, model ineligible, channels
            missing, etc.).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '426':
          description: Unpaid invoices. Settle them before placing a new order.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: >-
            Rate limit exceeded, or another order request for this account is in
            progress.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: >-
            Server error. Body always reads `{success:false,
            error:"server_error", message:"Server error"}` (no internal details
            leak).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: Upstream order service unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CplOrderCreateRequest:
      type: object
      required:
        - offer_id
        - of_account_id
        - quantity
        - campaign_type
        - approved_cpl_terms
      properties:
        offer_id:
          type: integer
          minimum: 1
        of_account_id:
          type: integer
          minimum: 1
          description: Numeric id of one of your linked OF accounts.
        quantity:
          type: integer
          minimum: 1
          description: >-
            Number of fans to deliver. Must fall inside the offer's
            `[min_quantity, max_quantity]` range.
        campaign_type:
          type: string
          enum:
            - free
            - paid
            - paid_trial
        trial_days:
          type: integer
          enum:
            - 1
            - 3
            - 7
            - 14
            - 30
            - 90
            - 180
            - 360
          description: >-
            Required when `campaign_type=paid_trial`. Must be in the offer's
            `trial_days_available` set.
        content_channels:
          type: array
          items:
            type: string
            enum:
              - lifestyle
              - tiktok
              - lingerie
              - light_nudes
              - nudes
          description: >-
            Optional filter. When omitted, every live channel on the model is
            used. When set, the order uses only the listed channels (intersected
            with the live ones).
        auto_renewal:
          type: boolean
          default: false
          description: >-
            When true, the order auto-creates a follow-up of `auto_renewal_fans`
            size on completion.
        auto_renewal_fans:
          type: integer
          minimum: 1
          description: >-
            Required when `auto_renewal=true`. Number of fans for the
            auto-renewal order; must fall inside the offer's `[min_quantity,
            max_quantity]`.
        auto_renewal_max_price:
          type: number
          format: float
          minimum: 0
          maximum: 10000
          description: >-
            Required when `auto_renewal=true`. Per-fan price cap for the
            renewal; must be ≥ the server-computed per-fan cost for the
            requested quantity.
        hide_income_stats:
          type: boolean
          default: false
          description: >-
            When true, ROMI / income on this order is hidden from the
            partner-facing offer detail.
        approved_cpl_terms:
          type: boolean
          enum:
            - true
          description: >-
            Must be `true`. Attests acceptance of the CPL placement terms for
            this request.
    ErrorResponse:
      type: object
      description: Standard error envelope for all 4xx/5xx responses.
      required:
        - success
        - error
        - message
      properties:
        success:
          type: boolean
          enum:
            - false
          description: Always false on error responses.
        error:
          type: string
          description: Stable snake_case machine-readable error code. Branch on this.
          example: validation_failed
        message:
          type: string
          description: >-
            Human-friendly text. For 5xx this is always the literal `Server
            error`. For 4xx an actionable validation/auth message is returned.
        details:
          type: object
          nullable: true
          description: >-
            Optional per-field diagnostic information. On 422 carries `{<field>:
            ["error_code", ...]}`. On 402 (`insufficient_balance`) carries
            `{required, current}`. On 426 (`unpaid_invoices`) carries `{count,
            total, oldest_date_ts}`. Absent on most other errors.
          additionalProperties: true
        retry_after:
          type: integer
          nullable: true
          description: >-
            Seconds until the next request will succeed. Present only on 429
            responses (rate limit). Mirrors the `Retry-After` HTTP header.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Your API key from the Studio Dashboard

````