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

# Stage a low-level ad action job

> Prefer saving an action draft. This low-level endpoint can start immediately: inline actions auto-start unless autoStart is false. Set autoStart:false to stage, review all actions, then call start explicitly. Empty jobs use actionCount and PUT each action index before start. Idempotency does not make an uncertain platform mutation safe to replay.



## OpenAPI

````yaml /openapi.json post /platform/{resourceUrl}/action-jobs
openapi: 3.1.0
info:
  title: Bily API
  version: 1.0.0
  description: >-
    Discover stores, read analytics and commerce data, inspect connections, and
    run explicitly authorized actions with the Bily API.
  contact:
    name: Bily support
    email: support@bily.ai
servers:
  - url: https://app.bily.ai/api/customer/v1
    description: Production
security:
  - ApiKeyAuth: []
  - BearerAuth: []
tags:
  - name: Identity
    description: Discover the identity and organizations attached to a key.
  - name: Stores
    description: Discover stores within an organization.
  - name: Store data
    description: Read store profiles, readiness, catalogs, and connected accounts.
  - name: Commerce
    description: Run scoped commerce reads and explicitly approved GraphQL mutations.
  - name: Analytics
    description: >-
      Read normalized advertising, attribution, product, customer, and cohort
      metrics.
  - name: Analytics SQL
    description: Run constrained read-only SQL over store-scoped Bily datasets.
  - name: Customer journeys
    description: Read customer touchpoints within an authenticated store scope.
  - name: Connections
    description: Inspect available connections, support, and advertising assets.
  - name: Supported actions
    description: Synchronize connections and update supported advertising assets.
  - name: Campaign actions
    description: Create or clone supported advertising campaign resources.
  - name: Ad drafts and jobs
    description: Save, review, publish and reconcile immutable advertising changes.
  - name: Creative library
    description: >-
      Analyze references and retain generated images separately from ad
      publication.
  - name: Tracking connections
    description: >-
      List and manage store-scoped tracking connections without returning
      credential secrets.
  - name: Tracking evidence
    description: >-
      Inspect installation, incoming receipts, reviewed events and destination
      evidence within one workspace.
paths:
  /platform/{resourceUrl}/action-jobs:
    post:
      tags:
        - Ad drafts and jobs
      summary: Stage a low-level ad action job
      description: >-
        Prefer saving an action draft. This low-level endpoint can start
        immediately: inline actions auto-start unless autoStart is false. Set
        autoStart:false to stage, review all actions, then call start
        explicitly. Empty jobs use actionCount and PUT each action index before
        start. Idempotency does not make an uncertain platform mutation safe to
        replay.
      operationId: ads-create-action-job
      parameters:
        - name: resourceUrl
          in: path
          required: true
          description: Exact workspace URL returned by GET /context.
          schema:
            type: string
        - $ref: '#/components/parameters/OrganizationId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                actionCount:
                  type: integer
                  minimum: 1
                  maximum: 100
                actions:
                  type: array
                  minItems: 1
                  maxItems: 100
                  items:
                    $ref: '#/components/schemas/AdActionInput'
                autoStart:
                  type: boolean
                  description: >-
                    Use false for explicit review. Inline actions otherwise
                    start automatically.
                idempotencyKey:
                  type: string
                stopOnFailure:
                  type: boolean
      responses:
        '201':
          description: >-
            Read the returned identifier until processing reaches a terminal
            state. Acceptance alone does not confirm completion.
          headers:
            x-request-id:
              schema:
                type: string
              description: Keep this identifier for diagnostics.
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    const: true
                  job:
                    $ref: '#/components/schemas/AdActionJob'
                required:
                  - ok
                  - job
        '202':
          description: >-
            Read the returned identifier until processing reaches a terminal
            state. Acceptance alone does not confirm completion.
          headers:
            x-request-id:
              schema:
                type: string
              description: Keep this identifier for diagnostics.
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    const: true
                  job:
                    $ref: '#/components/schemas/AdActionJob'
                required:
                  - ok
                  - job
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/ServerError'
        '502':
          $ref: '#/components/responses/BadGateway'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  parameters:
    OrganizationId:
      name: x-bily-organization-id
      in: header
      required: false
      description: >-
        An organization ID returned by GET /context or GET /organizations. Omit
        it when a scoped key supplies the organization. Otherwise provide it
        when no organization is selected.
      schema:
        type: string
        example: org_01J8W7T9G3E6ZQ4M2K5N8P1R0S
  schemas:
    AdActionInput:
      type: object
      properties:
        capabilityId:
          type: string
        label:
          type:
            - string
            - 'null'
        body:
          type: object
          additionalProperties: true
      required:
        - capabilityId
        - body
    AdActionJob:
      type: object
      properties:
        id:
          type: string
        status:
          enum:
            - staging
            - queued
            - running
            - completed
            - completed_with_errors
            - failed
            - cancelled
          type: string
        actionCount:
          type: integer
          minimum: 0
        completedCount:
          type: integer
          minimum: 0
        succeededCount:
          type: integer
          minimum: 0
        failedCount:
          type: integer
          minimum: 0
        actions:
          type: array
          items:
            type: object
            properties:
              index:
                type: integer
                minimum: 0
              capabilityId:
                type: string
              label:
                type: string
              status:
                enum:
                  - staged
                  - queued
                  - running
                  - succeeded
                  - failed
                  - cancelled
                type: string
              data: {}
              error:
                type: string
              httpStatus:
                type: integer
              retryable:
                type: boolean
              details: {}
            required:
              - index
              - capabilityId
              - label
              - status
        canRetry:
          type: boolean
        canCancel:
          type: boolean
        cancelRequestedAt:
          type:
            - string
            - 'null'
      required:
        - id
        - status
        - actionCount
        - completedCount
        - succeededCount
        - failedCount
        - actions
        - canRetry
        - canCancel
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          example: Store not found
        requestId:
          type: string
          description: Present on some server errors.
        details:
          description: Optional safe details for an action failure.
        retryAfter:
          type:
            - string
            - 'null'
      additionalProperties: true
  responses:
    BadRequest:
      description: The request path, query, or body is invalid.
      headers:
        x-request-id:
          description: The request identifier selected or generated by Bily.
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Authentication is missing or invalid.
      headers:
        x-request-id:
          description: The request identifier selected or generated by Bily.
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The identity or API key is not allowed to perform this request.
      headers:
        x-request-id:
          description: The request identifier selected or generated by Bily.
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The resource was not found in the caller's accessible scope.
      headers:
        x-request-id:
          description: The request identifier selected or generated by Bily.
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Conflict:
      description: The request conflicts with the current resource state.
      headers:
        x-request-id:
          description: The request identifier selected or generated by Bily.
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooManyRequests:
      description: The request rate is too high.
      headers:
        x-request-id:
          description: The request identifier selected or generated by Bily.
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServerError:
      description: Bily could not complete the request.
      headers:
        x-request-id:
          description: The request identifier selected or generated by Bily.
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BadGateway:
      description: A dependent Bily operation was temporarily unavailable.
      headers:
        x-request-id:
          description: The request identifier selected or generated by Bily.
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServiceUnavailable:
      description: >-
        Authentication or a required data source is temporarily unavailable.
        Honor Retry-After when present; do not interpret this as an invalid key
        or an empty dataset.
      headers:
        x-request-id:
          description: The request identifier selected or generated by Bily.
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        A server-side Bily API key created under Settings > AI tools > Access
        keys. Select the intended workspace before creating it.
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Bily API key
      description: An alternative way to send the same server-side Bily API key.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.