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

# Create buy orders

> Creates one or more pre-launch buy orders for the listed projects — each buy order auto-buys that project's future token at launch.

- Each item is processed independently. The response is always HTTP 200 once authenticated and the body is valid — check the per-item `ok` flag in `results` (index-aligned to your request) for each outcome.
- Re-ordering a project that already has an active buy order is idempotent (`status: "unchanged"`).



## OpenAPI

````yaml https://thefirm.biz/api/public/v1/openapi.json post /api/public/v1/orders
openapi: 3.1.0
info:
  title: AutoBoy Public API
  version: 0.1.0
  description: >-
    REST API for AutoBoy — browse projects, view detailed stats about your own
    launch, create buy orders and manage your AutoBoy smart wallet.


    ## Authentication


    Most endpoints require an API key, sent as a bearer token:


    ```

    Authorization: Bearer autoboy_…

    ```


    ## Quick start


    1. **Request a key** — `POST /api/public/v1/api-key-requests`

    2. **Register a project** — `POST /api/public/v1/projects`.


    New to AutoBoy? Read the product docs https://docs.thefirm.biz.
servers:
  - url: https://thefirm.biz
security: []
tags:
  - name: API Keys
    description: Request, create, and inspect API keys.
  - name: Projects
    description: Browse projects and their buyers.
  - name: Buy Orders
    description: Read and manage the API key owner's pre-launch buy orders.
  - name: AutoBoy Wallet
    description: Balances of, and withdrawals from, the AutoBoy smart wallet.
  - name: Feedback
    description: Send feedback to The Firm.
paths:
  /api/public/v1/orders:
    post:
      tags:
        - Buy Orders
      summary: Create buy orders
      description: >-
        Creates one or more pre-launch buy orders for the listed projects — each
        buy order auto-buys that project's future token at launch.


        - Each item is processed independently. The response is always HTTP 200
        once authenticated and the body is valid — check the per-item `ok` flag
        in `results` (index-aligned to your request) for each outcome.

        - Re-ordering a project that already has an active buy order is
        idempotent (`status: "unchanged"`).
      operationId: createBuyOrders
      requestBody:
        required: true
        description: The projects to order and their per-project buy caps.
        content:
          application/json:
            schema:
              type: object
              properties:
                items:
                  type: array
                  items:
                    type: object
                    properties:
                      slug:
                        type: string
                        minLength: 1
                        description: >-
                          Public project slug identifying the project to place a
                          buy order for.
                        example: thefirm
                      maxSpendUsdc:
                        type: string
                        pattern: ^\d+(\.\d+)?$
                        description: >-
                          Maximum USDC to spend auto-buying this project on each
                          buy.
                        example: '50'
                      maxFdvUsdc:
                        type: string
                        pattern: ^\d+(\.\d+)?$
                        description: >-
                          Maximum fully-diluted valuation, in USDC, at which the
                          auto-buy should execute. Omit to set NO FDV cap — the
                          project is then bought at any market cap.
                        example: '5000000'
                      expiresInMs:
                        type: integer
                        minimum: 1000
                        maximum: 86400000
                        description: How long, in milliseconds, the buy order stays active.
                        example: 86400000
                    required:
                      - slug
                      - maxSpendUsdc
                      - expiresInMs
                  minItems: 1
                  maxItems: 50
              required:
                - items
      responses:
        '200':
          description: Per-item results for the batch.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BuyOrderMutationResponse'
              example:
                results:
                  - slug: thefirm
                    ok: true
                    status: created
                  - slug: charms
                    ok: true
                    status: unchanged
                  - slug: no-such-project
                    ok: false
                    code: unknown_project
                    message: No project matches the slug
        '400':
          description: Malformed JSON, an invalid body, or an over-limit batch.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Bad request
                message: Invalid request body
        '401':
          description: Missing, invalid, or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                missingAuthorizationHeader:
                  value:
                    error: Unauthorized
                    message: Missing or invalid Authorization header
                invalidApiKey:
                  value:
                    error: Unauthorized
                    message: Invalid API key
        '500':
          description: An unexpected server-side error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Internal server error
                message: Failed to create buy orders
      security:
        - apiKeyAuth: []
components:
  schemas:
    BuyOrderMutationResponse:
      type: object
      properties:
        results:
          type: array
          items:
            oneOf:
              - type: object
                properties:
                  slug:
                    type: string
                    example: thefirm
                  ok:
                    type: boolean
                    enum:
                      - true
                  status:
                    type: string
                    enum:
                      - created
                      - updated
                      - deleted
                      - unchanged
                      - already_deleted
                    example: created
                required:
                  - slug
                  - ok
                  - status
              - type: object
                properties:
                  slug:
                    type: string
                    example: no-such-project
                  ok:
                    type: boolean
                    enum:
                      - false
                  code:
                    type: string
                    enum:
                      - unknown_project
                      - already_exists
                      - not_found
                      - not_modifiable
                      - invalid_value
                      - duplicate_in_request
                    example: unknown_project
                  message:
                    type: string
                    example: No project matches the slug
                required:
                  - slug
                  - ok
                  - code
                  - message
      required:
        - results
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
      required:
        - error
        - message
      example:
        error: Bad request
        message: Invalid request body
  securitySchemes:
    apiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: API key issued via POST /api/public/v1/api-keys.

````