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

# Estimate workflow price

> Estimate the Creative Units cost of running a workflow with given inputs.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/workspaces/{workspace_id}/workflows/{workflow_id}/estimate
openapi: 3.1.0
info:
  title: Layer REST API
  description: >
    REST API for AI-powered game asset creation on the Layer platform.


    ## Authentication


    All endpoints require a Bearer token in the `Authorization` header:


    ```

    Authorization: Bearer <token>

    ```


    ### Personal Access Tokens (recommended)


    The simplest way to authenticate is with a Personal Access Token (PAT):


    1. Log in to [app.layer.ai](https://app.layer.ai)

    2. Go to **Settings > Personal Access Tokens**

    3. Click **Create Token**, give it a name, and copy the token value

    4. Pass it as `Authorization: Bearer <your-pat-token>`


    PATs are long-lived and ideal for scripts, CI pipelines, and partner
    integrations.


    ### OAuth2 (browser-based)


    For browser-based applications, use the Auth0 OAuth2 flow. Redirect users to

    the Layer login page, exchange the authorization code for a JWT access
    token,

    and use it as `Authorization: Bearer <jwt>`.


    ## Creative Units


    Generations consume Creative Units (CUs). Use the estimate endpoints to
    check

    cost before executing. Check workspace balance via `GET
    /v1/workspaces/{id}`.


    ## Pagination


    List endpoints support cursor-based pagination via `limit` and `cursor`
    query

    parameters. Responses include a `pagination` object with `next_cursor`,

    `has_more_results`, and `total_count`. Cursors are opaque — do not parse or

    construct them.


    ## Errors


    All errors return [RFC 7807 Problem
    Details](https://tools.ietf.org/html/rfc7807):


    ```json

    {
      "type": "https://api.layer.ai/errors/ERROR_CODE",
      "title": "Human-readable title",
      "status": 404,
      "detail": "Detailed description of what went wrong."
    }

    ```


    Common status codes: `401` (unauthenticated), `402` (insufficient balance),

    `403` (forbidden), `404` (not found), `422` (invalid input), `429` (rate
    limited).
  version: 1.0.0
servers:
  - url: https://api.app.layer.ai/api
    description: Production
  - url: /backend/rest
    description: Local development
security: []
paths:
  /v1/workspaces/{workspace_id}/workflows/{workflow_id}/estimate:
    post:
      tags:
        - Workflows
      summary: Estimate workflow price
      description: >-
        Estimate the Creative Units cost of running a workflow with given
        inputs.
      operationId: estimateWorkflowPrice
      parameters:
        - name: workspace_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Workspace Id
        - name: workflow_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Workflow Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EstimateWorkflowPriceRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EstimateWorkflowPriceOutput'
        '401':
          description: Unauthenticated — missing or invalid Bearer token.
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    example: https://api.layer.ai/errors/ERROR_CODE
                  title:
                    type: string
                    example: Error Title
                  status:
                    type: integer
                    example: 400
                  detail:
                    type: string
                    example: Human-readable description.
                required:
                  - type
                  - title
                  - status
                  - detail
        '402':
          description: Insufficient Creative Units balance.
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    example: https://api.layer.ai/errors/ERROR_CODE
                  title:
                    type: string
                    example: Error Title
                  status:
                    type: integer
                    example: 400
                  detail:
                    type: string
                    example: Human-readable description.
                required:
                  - type
                  - title
                  - status
                  - detail
        '403':
          description: Forbidden — insufficient permissions.
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    example: https://api.layer.ai/errors/ERROR_CODE
                  title:
                    type: string
                    example: Error Title
                  status:
                    type: integer
                    example: 400
                  detail:
                    type: string
                    example: Human-readable description.
                required:
                  - type
                  - title
                  - status
                  - detail
        '404':
          description: Resource not found.
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    example: https://api.layer.ai/errors/ERROR_CODE
                  title:
                    type: string
                    example: Error Title
                  status:
                    type: integer
                    example: 400
                  detail:
                    type: string
                    example: Human-readable description.
                required:
                  - type
                  - title
                  - status
                  - detail
        '422':
          description: Invalid input parameters.
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    example: https://api.layer.ai/errors/ERROR_CODE
                  title:
                    type: string
                    example: Error Title
                  status:
                    type: integer
                    example: 400
                  detail:
                    type: string
                    example: Human-readable description.
                required:
                  - type
                  - title
                  - status
                  - detail
        '429':
          description: Rate limited — too many concurrent requests.
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    example: https://api.layer.ai/errors/ERROR_CODE
                  title:
                    type: string
                    example: Error Title
                  status:
                    type: integer
                    example: 400
                  detail:
                    type: string
                    example: Human-readable description.
                required:
                  - type
                  - title
                  - status
                  - detail
        '500':
          description: Internal server error.
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    example: https://api.layer.ai/errors/ERROR_CODE
                  title:
                    type: string
                    example: Error Title
                  status:
                    type: integer
                    example: 400
                  detail:
                    type: string
                    example: Human-readable description.
                required:
                  - type
                  - title
                  - status
                  - detail
      security:
        - HTTPBearer: []
components:
  schemas:
    EstimateWorkflowPriceRequest:
      properties:
        inputs:
          additionalProperties: true
          type: object
          title: Inputs
          description: Workflow inputs matching the workflow's input schema.
      type: object
      required:
        - inputs
      title: EstimateWorkflowPriceRequest
    EstimateWorkflowPriceOutput:
      properties:
        estimated_price_creative_units:
          type: number
          title: Estimated Price Creative Units
          description: Total estimated Creative Units price for this run.
        output_counts:
          items:
            $ref: '#/components/schemas/EstimateWorkflowOutputCount'
          type: array
          title: Output Counts
          description: Expected output count for each workflow output parameter.
        workspace_balance_creative_units:
          type: number
          title: Workspace Balance Creative Units
          description: >-
            Usable Creative Units balance (total balance minus reserved by
            in-progress generations).
        estimated_remaining_balance_creative_units:
          type: number
          title: Estimated Remaining Balance Creative Units
          description: >-
            Usable balance after subtracting the estimated price. Can be
            negative.
        has_sufficient_creative_units:
          type: boolean
          title: Has Sufficient Creative Units
          description: >-
            Whether the workspace has enough available Creative Units to cover
            the estimated price.
      type: object
      required:
        - estimated_price_creative_units
        - output_counts
        - workspace_balance_creative_units
        - estimated_remaining_balance_creative_units
        - has_sufficient_creative_units
      title: EstimateWorkflowPriceOutput
    EstimateWorkflowOutputCount:
      properties:
        output:
          $ref: '#/components/schemas/WorkflowOutput'
          description: The output parameter definition.
        count:
          type: integer
          title: Count
          description: The expected number of outputs
      type: object
      required:
        - output
        - count
      title: EstimateWorkflowOutputCount
    WorkflowOutput:
      properties:
        name:
          type: string
          title: Name
          description: Output parameter name
        type:
          type: string
          title: Type
          description: 'Output type: file, string, etc.'
        value_schema:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Value Schema
          description: JSON schema of the output value
        description:
          type: string
          title: Description
          description: What this output contains
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
          description: Human-readable label
      type: object
      required:
        - name
        - type
        - description
      title: WorkflowOutput
  securitySchemes:
    HTTPBearer:
      type: http
      description: >-
        Personal Access Token or OAuth2 JWT. Create a PAT at app.layer.ai →
        Settings → Personal Access Tokens.
      scheme: bearer

````