Skip to main content
API v1 is deprecated and will be removed in the future. Please migrate to API v2 for new features and long-term support.

Overview

The OpenAI Responses API is a stateful API designed for long-running tasks that require asynchronous processing. We’ve made our API compatible with the Responses API, allowing you to use the OpenAI SDK with Manus for complex reasoning tasks, document analysis, and multi-step workflows. Manus handles the heavy lifting while you track progress asynchronously, making it perfect for automation, research, and complex applications.

Prerequisites

Before you begin:
  1. Sign up for a Manus account
  2. Generate your API key from the dashboard
  3. Install Python 3.10 or higher

Installation

Install the OpenAI Python SDK:
Note: We’ve tested compatibility with OpenAI Python SDK versions up to 1.100.2.
Manus uses API key-based authentication via headers. Set up your client with these approaches:
The api_key parameter to the OpenAI client can be any placeholder value - Manus reads the actual API key from the API_KEY header.

Your First Task

When working with Manus, tasks run asynchronously, meaning they don’t block your program while they’re being processed. Before we dive into the code, let’s cover the different statuses a task can have:
  • running: The initial state when you first dispatch a task. It means the agent is actively working on your request.
  • pending: The agent has paused its work and is waiting for more input from a user. This often happens in interactive sessions.
  • completed: The task finished successfully, and the full results are now available to be retrieved.
  • error: The task could not be completed because it ran into an error.
Polling involves periodically checking the task’s status until it’s either completed or encounters an error. This approach is straightforward and works well for many use cases. If you’d like to see how to setup a webhook with Manus, check out our guide on how to do so.

Creating a Task

First, Let’s create a task using the Manus API. When you do this, you receive a response object that contains a unique id for your task. This id is crucial for tracking the task’s status.
To find out about the status of your task, you can use the retrieve method to get the latest status of the task. This can be done with a simple while loop.
Once the loop finishes, the task is completed, has failed or is pending your input. You can then inspect the final Response object to get the full conversation. The final result, including all messages from both the user and the assistant are contained in the output field.
The most important field here is output, which contains the full conversation history as a list of ResponseOutputMessage objects. Each message includes a role (user or assistant) and its content, allowing you to easily parse the entire interaction. You can see a full list of all of the output files and messages that Manus has generated in the output field of the Response object.

File Management

The Files API allows you to manage file uploads separately from task creation. This is useful when you want to reuse files across multiple tasks or pre-upload large files.

Uploading Files

To upload a file, first create a file record to get an upload URL, then upload your file to that URL:
The presigned upload URL expires in 3 minutes for security. Complete your upload before it expires.
Uploaded files are automatically deleted after 48 hours. Reference them in your tasks before they expire. If you’d like to delete them manually, you can do so using the Files API.

File Status

Files progress through the following states:
  • pending: File record created, waiting for upload to complete
  • uploaded: File successfully uploaded and ready to use in tasks
  • deleted: File has been deleted (manually or automatically after 48 hours)

Retrieving File Details

Check the status and details of your uploaded file:

Listing Files

Retrieve all files you’ve uploaded:

Deleting Files

Remove files you no longer need:
Deleting a file marks it as deleted and you will no longer be able to use the file in tasks.

Working with Content

Text Input

For simple text-based tasks, use input_text:

Files

Include various file types in your tasks using these methods:
Supported file types:
  • Documents: PDF, DOCX, TXT, MD
  • Spreadsheets: CSV, XLSX
  • Code: JSON, YAML, Python, JavaScript, and more
When using base64, include the proper MIME type prefix (e.g., data:application/pdf;base64, for PDFs).

Images

Include images for visual analysis using these methods:
Supported image formats:
  • PNG, JPEG/JPG, GIF, WebP
For images, use "type": "input_image" and provide the URL via image_url. Include proper MIME type prefixes for base64 uploads.

Multi-turn Conversations

Build sophisticated workflows by continuing conversations across multiple requests. Just use the previous_response_id or task_id to link to the previous conversation.
Context Preservation: The agent remembers previous context, uploaded files, and intermediate results across conversation turns, enabling complex multi-step tasks.
Use either previous_response_id or task_id in extra_body, but not both in the same request.

Projects

Projects allow you to organize tasks and apply consistent instructions across multiple tasks. When you assign a task to a project, the project’s instruction is automatically applied.
Create and manage projects via the Projects API. The project’s instruction will be applied to all tasks created within it.

Task Management

Retrieve all your tasks, including those created through the Manus webapp:
This returns all your tasks, not just API-created ones.
Find specific tasks using these parameters:
Response format:
  • data: Array of task objects
  • first_id: ID of first task in results
  • last_id: ID of last task (for pagination)
  • has_more: Whether more tasks exist

Pagination

Handle large numbers of tasks efficiently:
Pagination Direction: order=desc moves from newest → oldest, order=asc moves from oldest → newest.
Available Parameters:

Deleting Tasks

Remove completed tasks to keep your workspace organized:
This permanently removes the task and all associated data. Save important outputs first!

Updating Tasks

Modify task settings after creation:
Useful for:
  • Enabling sharing after task completion
  • Hiding/showing tasks in your workspace
  • Renaming tasks for better organization
Update only the fields you want to change - others remain unchanged.

Sharing & Visibility

Public Sharing

Make tasks accessible to others using shareable links:
Anyone with the share URL can view the task and its results. Only enable for non-sensitive content.

Task Visibility

Control which tasks appear in your workspace:

Best Practices

Workspace Management:
  • Delete completed tasks you no longer need
  • Use hide_in_task_list for automated workflows to avoid clutter
  • Save important outputs before deleting tasks
Security:
  • Only enable create_shareable_link for non-sensitive tasks
  • Be mindful of what information you’re sharing publicly
  • Use environment variables for API keys in production
Performance:
  • Use appropriate agent profiles (manus-1.6-lite for simple tasks, manus-1.6 for general tasks, manus-1.6-max for complex analysis)
  • Monitor task status rather than polling constantly
  • Batch similar tasks when possible for efficiency
Error Handling:
  • Always check task status before accessing results
  • Handle failed tasks gracefully in your applications
  • Save task IDs for debugging and monitoring