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

# Generate campaign matches

> Generate creator matches from stored campaign goal (owner only). Runs one creator search through same gates and credit spend as GET /api/search; saves shortlist as matches (idempotent on campaign + profileId). Optional body filters narrow search; query always comes from goal. 402 is out-of-credits without Payment challenge (machine settlement rail is on /api/search).



## OpenAPI

````yaml POST /api/campaigns/{id}/generate
openapi: 3.1.0
info:
  description: >-
    Starcovery helps you find and hire real Instagram and TikTok creators from a
    plain-language brief, on the web or from your agents. REST and MCP API.
    Search accepts unsigned callers. Campaigns, billing state, and keys accept
    browser session, x-api-key, or Bearer. MCP accepts OAuth, x-api-key, Bearer,
    or last-resort ?api_key= (no session). Machine Payments Protocol
    (x-payment-info) on GET /api/search when provisioned. Signup and claim at
    auth.md.
  title: Starcovery
  version: 1.0.0
servers:
  - url: https://www.starcovery.com
security: []
paths:
  /api/campaigns/{id}/generate:
    post:
      summary: Generate campaign matches
      description: >-
        Generate creator matches from stored campaign goal (owner only). Runs
        one creator search through same gates and credit spend as GET
        /api/search; saves shortlist as matches (idempotent on campaign +
        profileId). Optional body filters narrow search; query always comes from
        goal. 402 is out-of-credits without Payment challenge (machine
        settlement rail is on /api/search).
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: false
              properties:
                country:
                  enum:
                    - us
                    - gb
                    - ca
                    - au
                    - de
                    - fr
                    - br
                    - jp
                    - kr
                    - in
                  type: string
                platform:
                  enum:
                    - ig
                    - tt
                  type: string
                tier:
                  enum:
                    - nano
                    - micro
                    - mid
                    - macro
                    - mega
                  type: string
              type: object
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/CampaignBody'
                  - properties:
                      generated:
                        description: >-
                          How many searched creators landed or refreshed as
                          matches.
                        type: integer
                    required:
                      - generated
                    type: object
          description: Campaign body plus generated count
        '400':
          description: invalid_body
        '401':
          description: >-
            unauthorized: missing identity; WWW-Authenticate points at
            protected-resource metadata
        '402':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OutOfCredits'
          description: out_of_credits
        '404':
          description: not_found
        '429':
          description: Rate limited
      security:
        - ApiKeyHeader: []
        - BearerAuth: []
        - SessionCookie: []
components:
  schemas:
    CampaignBody:
      additionalProperties: false
      properties:
        campaign:
          $ref: '#/components/schemas/CampaignRow'
        matches:
          items:
            $ref: '#/components/schemas/CampaignMatch'
          type: array
        owned:
          description: True if caller owns campaign.
          type: boolean
      required:
        - campaign
        - matches
        - owned
      type: object
    OutOfCredits:
      additionalProperties: false
      properties:
        authUrl:
          format: uri
          type: string
        error:
          const: out_of_credits
          type: string
        freeGrant:
          description: >-
            Which free grant ran out (omitted on force_payment dry-run
            challenges).
          enum:
            - identified_daily
            - none
          type: string
        machinePayment:
          description: MPP posture for this deployment. available=false on Vercel preview.
          oneOf:
            - additionalProperties: false
              properties:
                available:
                  const: true
                  type: boolean
                challengeHeader:
                  type:
                    - string
                    - 'null'
                dryRun:
                  type: string
                retry:
                  type: string
              required:
                - available
                - challengeHeader
                - dryRun
                - retry
              type: object
            - additionalProperties: false
              properties:
                available:
                  const: false
                  type: boolean
                hint:
                  type: string
              required:
                - available
                - hint
              type: object
        packsUrl:
          format: uri
          type: string
      required:
        - authUrl
        - error
        - machinePayment
        - packsUrl
      type: object
    CampaignRow:
      additionalProperties: false
      properties:
        createdAt:
          format: date-time
          type: string
        createdBy:
          enum:
            - agent
            - human
          type: string
        goal:
          type: string
        id:
          type: string
        name:
          type: string
        status:
          enum:
            - active
            - archived
            - draft
          type: string
        updatedAt:
          format: date-time
          type: string
        userId:
          type: string
        visibility:
          enum:
            - private
            - public
          type: string
      required:
        - createdAt
        - createdBy
        - goal
        - id
        - name
        - status
        - updatedAt
        - userId
        - visibility
      type: object
    CampaignMatch:
      additionalProperties: false
      properties:
        addedAt:
          format: date-time
          type: string
        campaignId:
          type: string
        fitScore:
          type:
            - number
            - 'null'
        followerCount:
          maximum: 2147483647
          minimum: 1000
          type: integer
        handle:
          type: string
        id:
          type: string
        name:
          type:
            - string
            - 'null'
        platform:
          enum:
            - ig
            - tt
          type: string
        profileId:
          type: string
        profileImageUrl:
          type:
            - string
            - 'null'
        source:
          enum:
            - generated
            - manual
          type: string
      required:
        - addedAt
        - campaignId
        - fitScore
        - followerCount
        - handle
        - id
        - name
        - platform
        - profileId
        - profileImageUrl
        - source
      type: object
  securitySchemes:
    ApiKeyHeader:
      description: Product API key or agent access token
      in: header
      name: x-api-key
      type: apiKey
    BearerAuth:
      bearerFormat: access token
      description: >-
        Bearer access token (agent registration), product API key, or MCP OAuth
        access token
      scheme: bearer
      type: http
    SessionCookie:
      description: >-
        Browser better-auth session cookie (REST only; MCP rejects sessions).
        Name is better-auth.session_token, or __Secure-better-auth.session_token
        on HTTPS.
      in: cookie
      name: better-auth.session_token
      type: apiKey

````