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

# Create File Blueprint

> Create a Document Blueprint for an uploaded file.

Create a document blueprint for an uploaded file.

<RequestExample>
  ```python Python theme={null}
  from retab import Retab

  client = Retab()

  blueprint = client.files.create_blueprint(
      file_id="file_a1b2c3d4e5f6",
      intent="Identify the statement fields and transaction table",
      background=True,
  )

  print(blueprint.id)
  ```

  ```typescript TypeScript theme={null}
  import { Retab } from "@retab/node";

  const client = new Retab({ apiKey: process.env.RETAB_API_KEY });

  const blueprint = await client.files.create_blueprint(
    "file_a1b2c3d4e5f6",
    "Identify the statement fields and transaction table",
    "instant",
    true
  );

  console.log(blueprint.id);
  ```

  ```go Go theme={null}
  package main

  import (
  	"context"
  	"fmt"
  	"log"

  	retab "github.com/retab-dev/retab/clients/go"
  )

  func main() {
  	client, err := retab.NewClient("")
  	if err != nil {
  		log.Fatal(err)
  	}

  	blueprint, err := client.Files.CreateBlueprint(context.Background(), &retab.FilesCreateBlueprintParams{
  		FileID:     "file_a1b2c3d4e5f6",
  		Intent:     retab.Ptr("Identify the statement fields and transaction table"),
  		Background: retab.Ptr(true),
  	})
  	if err != nil {
  		log.Fatal(err)
  	}

  	fmt.Println(blueprint.ID)
  }
  ```

  ```java Java theme={null}
  import com.retab.RetabClient;

  public final class Example {
    public static void main(String[] args) throws Exception {
      RetabClient client = new RetabClient(System.getenv("RETAB_API_KEY"));

      var blueprint = client.files().createBlueprint(
          "file_a1b2c3d4e5f6",
          "Identify the statement fields and transaction table",
          null,
          true);

      System.out.println(blueprint.getId());
    }
  }
  ```

  ```rust Rust theme={null}
  use retab::models::CreateFileBlueprintRequest;
  use retab::resources::files::CreateBlueprintParams;
  use retab::Retab;

  #[tokio::main]
  async fn main() -> Result<(), Box<dyn std::error::Error>> {
      let client = Retab::new(std::env::var("RETAB_API_KEY")?);

      let mut request = CreateFileBlueprintRequest::new("file_a1b2c3d4e5f6");
      request.intent = Some("Identify the statement fields and transaction table".into());
      request.background = Some(true);

      let blueprint = client
          .files()
          .create_blueprint(CreateBlueprintParams::new(request))
          .await?;

      println!("{}", blueprint.id);
      Ok(())
  }
  ```

  ```csharp C# theme={null}
  using Retab;
  using RetabClient = Retab.Retab;

  var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
  var client = new RetabClient(apiKey);

  var blueprint = await client.Files.CreateBlueprintAsync(new FilesCreateBlueprintOptions
  {
      FileId = "file_a1b2c3d4e5f6",
      Intent = "Identify the statement fields and transaction table",
      Background = true,
  });

  Console.WriteLine(blueprint.Id);
  ```

  ```php PHP theme={null}
  <?php
  require 'vendor/autoload.php';

  use Retab\Client;

  $client = new Client(apiKey: getenv('RETAB_API_KEY'));

  $blueprint = $client->files()->createBlueprint(
      fileId: 'file_a1b2c3d4e5f6',
      intent: 'Identify the statement fields and transaction table',
      background: true,
  );

  echo $blueprint->id;
  ```

  ```ruby Ruby theme={null}
  require 'retab'

  client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])

  blueprint = client.files.create_blueprint(
    file_id: 'file_a1b2c3d4e5f6',
    intent: 'Identify the statement fields and transaction table',
    background: true,
  )

  puts blueprint.id
  ```

  ```curl cURL theme={null}
  curl -X POST \
    'https://api.retab.com/v1/files/blueprints' \
    -H "Authorization: Bearer $RETAB_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
      "file_id": "file_a1b2c3d4e5f6",
      "intent": "Identify the statement fields and transaction table",
      "background": true
    }'
  ```
</RequestExample>


## OpenAPI

````yaml POST /v1/files/blueprints
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.retab.com
security: []
paths:
  /v1/files/blueprints:
    post:
      tags:
        - Files
        - File Blueprints
      summary: Create File Blueprint
      description: Create a Document Blueprint for an uploaded file.
      operationId: create_file_blueprint
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFileBlueprintRequest'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileBlueprint'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    CreateFileBlueprintRequest:
      properties:
        file_id:
          type: string
          title: File Id
          description: File id to analyze.
        intent:
          anyOf:
            - type: string
            - type: 'null'
          title: Intent
          description: Optional user intent used to guide the blueprint analysis.
        mode:
          anyOf:
            - type: string
              enum:
                - instant
                - reasoning
            - type: 'null'
          title: Mode
          description: >-
            Legacy compatibility field. Blueprint analysis always runs a single
            pass.
        background:
          type: boolean
          title: Background
          description: >-
            If true, run asynchronously: returns immediately with status
            'queued' and an empty output. Poll GET /v1/<primitive>/{id} until
            status is terminal. Mutually exclusive with stream.
          default: false
      type: object
      required:
        - file_id
      title: CreateFileBlueprintRequest
      description: Public create-file-blueprint request body.
    FileBlueprint:
      properties:
        object:
          type: string
          const: file.blueprint
          title: Object
          default: file.blueprint
        id:
          type: string
          title: Id
          description: Unique identifier of the file blueprint.
        file:
          $ref: '#/components/schemas/FileRef'
          description: Information about the analyzed file.
        intent:
          anyOf:
            - type: string
            - type: 'null'
          title: Intent
          description: User intent supplied with the blueprint request.
        output:
          additionalProperties: true
          type: object
          title: Output
          description: The generated Document Blueprint payload.
          default: {}
        status:
          type: string
          enum:
            - pending
            - queued
            - in_progress
            - completed
            - failed
            - cancelled
          title: Status
          description: >-
            Lifecycle status. The synchronous path returns 'completed'.
            Background runs progress pending -> queued -> in_progress ->
            completed | failed | cancelled.
          default: pending
        error:
          anyOf:
            - $ref: '#/components/schemas/PrimitiveError'
            - type: 'null'
          description: >-
            Error details when a background run fails; null otherwise. Always
            present so consumers can read it without an existence check.
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
        started_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Started At
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Completed At
        mode:
          anyOf:
            - type: string
              enum:
                - instant
                - reasoning
            - type: 'null'
          title: Mode
      type: object
      required:
        - file
        - id
      title: FileBlueprint
      description: A document blueprint generated from an uploaded file.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
          default: []
      type: object
      title: HTTPValidationError
    FileRef:
      properties:
        id:
          type: string
          title: Id
          description: ID of the file
        filename:
          type: string
          title: Filename
          description: Filename of the file
        mime_type:
          type: string
          title: Mime Type
          description: MIME type of the file
      type: object
      required:
        - filename
        - id
        - mime_type
      title: FileRef
      description: Public/shared file reference used across SDK and customer-facing APIs.
    PrimitiveError:
      properties:
        code:
          type: string
          title: Code
          description: Machine-readable error code.
        message:
          type: string
          title: Message
          description: Human-readable error message.
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: Optional structured error context.
      type: object
      required:
        - code
        - message
      title: PrimitiveError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
          default: null
        ctx:
          type: object
          title: Context
          default: {}
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````