Documentation
API Reference
Playground

Overview

Getting startedModelsDeployment Options

Integrations

Hermes AgentClaude CodeCodex

Studio

Upstage Studio
API QuickstartCreate a workflowUse and manage workflowsUpload and manage filesRun workflows and read results

Capabilities

Generate
Parse
Extract
Embed

Deployment Options

Guides

Rate limitsContributor modeCounting tokensMCP serverRegional endpointsBeta services

Resources

CookbookPricingStatusChangelogError codesFAQ

Terms and Policies

Terms of UsePrivacy PolicyService level agreement

API Quickstart

Use the Studio API to create and run document-processing workflows from your application. Save a sequence of steps once and apply it to new documents as they arrive.

A workflow is a saved document-processing procedure. Individual Document Parse and Information Extract APIs each perform one task; a workflow connects tasks and keeps their settings together. This guide creates a workflow through the API, without requiring you to build it in Studio first.

Already have a workflow in Studio? Use its ID and skip creation.

What you will build

Extract an invoice number and total from a sample invoice in two steps: Parse reads the document, then Extract selects the fields you requested.

Invoice PDF β†’ Parse β†’ Extract β†’ JSON data

Expected data for the fictional sample below (an illustration, not a recorded API response):

{
  "invoice_number": "INV-2026-001",
  "total": 125.0
}

1. Create a workflow

Use the OpenAI SDK for Python, or Bash with cURL and jq. Set UPSTAGE_API_KEY to your API key, then run the examples in order using the same language.

First, create a named workflow. Its processing steps will be added next.

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["UPSTAGE_API_KEY"],
    base_url="https://api.upstage.ai/v2",
)

workflow = client.post(
    "/agents",
    cast_to=dict[str, object],
    body={"name": "Invoice extraction", "visibility": "private"},
)
workflow_id = workflow["id"]
print("Workflow:", workflow_id)

Response excerpt (IDs in this guide are examples):

{"id":"agt_example","name":"Invoice extraction","default_config_id":null}

The code saves id as workflow_id. Keep this ID to reuse the workflow. The API retains the path /agents and IDs beginning with agt_; these identify workflows in this guide.

2. Save processing settings

A configuration version (Config) saves the steps and their settings together. A step is one action, such as reading or extracting; Studio calls these nodes. Here, steps connects Parse to Extract.

The schema under json_schema defines what to extract and its format: invoice_number is text (string), and total is a number (number). Change these fields for your own documents.

config = client.post(
    f"/agents/{workflow_id}/configs",
    cast_to=dict[str, object],
    body={
        "name": "Invoice v1",
        "is_default": True,
        "steps": [
            {
                "name": "Parse",
                "type": "document-parse",
                "data": {"model": "default"},
                "next_steps": [{"step_name": "Extract"}],
                "is_first": True,
            },
            {
                "name": "Extract",
                "type": "information-extract",
                "data": {
                    "model": "default",
                    "json_schema": {
                        "type": "object",
                        "properties": {
                            "invoice_number": {
                                "type": "string",
                                "description": "Invoice number, without the date",
                            },
                            "total": {
                                "type": "number",
                                "description": "Total invoice amount, without the currency symbol",
                            },
                        },
                        "required": ["invoice_number", "total"],
                    },
                },
                "next_steps": [],
                "is_first": False,
            },
        ],
    },
)
config_id = config["id"]
print("Config:", config_id)

Response excerpt:

{"id":"cfg_example","name":"Invoice v1","is_default":true}

is_first marks the starting step; next_steps names the next step. An empty array ends this sequence. data.model="default" uses the default model for that step. is_default=True selects this version when an execution does not specify a Config ID. Our example explicitly uses the returned config_id.

3. Upload the invoice

Download the sample invoice and upload it to get a File ID. The execution request uses this ID instead of uploading the file again.

with open("sample-invoice.pdf", "rb") as document:
    uploaded = client.files.create(file=document, purpose="user_data")
file_id = uploaded.id
print("File:", file_id)

Upload response excerpt:

{"id":"file_example","object":"file","filename":"sample-invoice.pdf"}

Save the returned file_id for the next request.

4. Start a job

A job (Job) is one execution of a workflow on input documents. Send the three IDs you have just received.

job = client.responses.create(
    model=workflow_id,
    input=[{"role": "user", "content": [{"type": "input_file", "file_id": file_id}]}],
    background=True,
    include=["last"],
    extra_body={"config_id": config_id},
)
job_id = job.id
print("Job:", job_id)

In Python, pass Studio’s additional config_id field through extra_body; it is not a named parameter of client.responses.create. The same field is sent directly in the JSON body with cURL.

{"id":"job_example","status":"in_progress","output":[]}

Here model is the workflow ID, not a model name. config_id chooses the saved settings, and file_id chooses the document. With background=True, the server returns a Job ID before processing finishes. include=["last"] requests the final step result, which is Extract in this example.

5. Read the result

Retrieve the job using its ID. If status is in_progress, run the same retrieval request again later. When it is completed, the extraction result is in output[].content[].text as a JSON string.

job = client.responses.retrieve(job_id, include=["last"])
print(job.model_dump_json(indent=2))

Completed response excerpt (values may vary):

{
  "id": "job_example",
  "status": "completed",
  "output": [
    {
      "content": [
        {
          "type": "output_text",
          "text": "{\"invoice_number\":\"INV-2026-001\",\"total\":125.0}"
        }
      ]
    }
  ]
}

If the status is failed or cancelled, check the response’s error. See Jobs and results for more about statuses.

Process another document

Keep workflow_id and config_id. For each new invoice, repeat upload, execution, and retrieval (steps 3–5). You do not need to recreate the workflow or settings. To change the extracted fields, create a new Config version; earlier settings remain available.

Use an existing Studio workflow

Open the workflow in Studio, save its settings, and select More (β‹―) β†’ Code in the upper-right corner. Copy Agent ID (the Workflow ID) and Config ID from this screen.

Studio Code screen for copying workflow and configuration IDs

Set up client as in step 1, assign the copied IDs to workflow_id and config_id, then start at step 3.

Create a workflow Β· Use and manage workflows Β· Jobs and results

Troubleshooting & FAQ

Fixes for the most common Studio problems, frequently asked questions, supported file formats, and a glossary.

Create a workflow

Create a workflow, add processing steps, and save the first version.

On this page

API QuickstartWhat you will build1. Create a workflow2. Save processing settings3. Upload the invoice4. Start a job5. Read the resultProcess another documentUse an existing Studio workflow