Skip to content

API Reference

Complete API reference for Strands Agents endpoints.

Base URL

https://api.universalapi.co

Authentication

Include credentials in every request:

Headers (Recommended):

X-Uni-UserId: your-user-id
X-Uni-SecretUniversalKey: your-secret-key

Query Parameters:

?userId=your-user-id&secretUniversalKey=your-secret-key

Agent Management

Create Agent

Create a new Strands Agent.

http
POST /agent/create

Request Body:

FieldTypeRequiredDescription
agentNamestringYesUnique name for the agent
descriptionstringYesDescription of what the agent does
sourceCodestringYesPython code with create_agent() function
visibilitystringNoprivate (default) or public
runtimestringNopython3.12 (default)
memoryMbnumberNoMemory allocation (default: 1024)
timeoutSecnumberNoTimeout in seconds (default: 300)

Example:

bash
curl -X POST "https://api.universalapi.co/agent/create" \
  -H "Content-Type: application/json" \
  -H "X-Uni-UserId: $USER_ID" \
  -H "X-Uni-SecretUniversalKey: $SECRET_KEY" \
  -d '{
    "agentName": "my-assistant",
    "description": "A helpful AI assistant",
    "sourceCode": "from strands import Agent\nfrom strands.models import BedrockModel\n\ndef create_agent():\n    model = BedrockModel(model_id=\"us.anthropic.claude-3-7-sonnet-20250219-v1:0\")\n    agent = Agent(model=model)\n    return agent, []"
  }'

Response:

json
{
  "success": true,
  "data": {
    "agentId": "5a8f5c4f-a3ca-44cc-8fe7-afec7a75653d",
    "agentName": "my-assistant",
    "description": "A helpful AI assistant",
    "status": "active",
    "visibility": "private",
    "runtime": "python3.12",
    "memoryMb": 1024,
    "timeoutSec": 300,
    "endpointUrl": "https://api.universalapi.co/agent/5a8f5c4f-a3ca-44cc-8fe7-afec7a75653d/chat",
    "createdAt": 1768666121176,
    "updatedAt": 1768666121176
  }
}

List Agents

List all agents owned by the authenticated user.

http
GET /agent/list

Query Parameters:

ParameterTypeDescription
visibilitystringFilter by public, private, or all
statusstringFilter by active, deleted

Example:

bash
curl "https://api.universalapi.co/agent/list" \
  -H "X-Uni-UserId: $USER_ID" \
  -H "X-Uni-SecretUniversalKey: $SECRET_KEY"

Response:

json
{
  "success": true,
  "data": {
    "agents": [
      {
        "agentId": "5a8f5c4f-a3ca-44cc-8fe7-afec7a75653d",
        "agentName": "my-assistant",
        "description": "A helpful AI assistant",
        "status": "active",
        "visibility": "private",
        "runtime": "python3.12",
        "memoryMb": 1024,
        "timeoutSec": 300,
        "invocationsPerMonth": 42,
        "endpointUrl": "https://api.universalapi.co/agent/5a8f5c4f-a3ca-44cc-8fe7-afec7a75653d/chat",
        "createdAt": 1768666121176,
        "updatedAt": 1768666121176
      }
    ]
  }
}

Get Agent

Get details of a specific agent.

http
GET /agent/{agentId}

Example:

bash
curl "https://api.universalapi.co/agent/5a8f5c4f-a3ca-44cc-8fe7-afec7a75653d" \
  -H "X-Uni-UserId: $USER_ID" \
  -H "X-Uni-SecretUniversalKey: $SECRET_KEY"

Response:

json
{
  "success": true,
  "data": {
    "agentId": "5a8f5c4f-a3ca-44cc-8fe7-afec7a75653d",
    "agentName": "my-assistant",
    "description": "A helpful AI assistant",
    "sourceCode": "from strands import Agent...",
    "status": "active",
    "visibility": "private",
    "runtime": "python3.12",
    "memoryMb": 1024,
    "timeoutSec": 300,
    "invocationsPerMonth": 42,
    "endpointUrl": "https://api.universalapi.co/agent/5a8f5c4f-a3ca-44cc-8fe7-afec7a75653d/chat",
    "createdAt": 1768666121176,
    "updatedAt": 1768666121176
  }
}

Update Agent

Update an existing agent.

http
PUT /agent/update
POST /agent/update

Request Body:

FieldTypeRequiredDescription
agentIdstringYesID of the agent to update
agentNamestringNoNew name
descriptionstringNoNew description
sourceCodestringNoNew source code
visibilitystringNoprivate or public
statusstringNoactive or deleted

Example:

bash
curl -X PUT "https://api.universalapi.co/agent/update" \
  -H "Content-Type: application/json" \
  -H "X-Uni-UserId: $USER_ID" \
  -H "X-Uni-SecretUniversalKey: $SECRET_KEY" \
  -d '{
    "agentId": "5a8f5c4f-a3ca-44cc-8fe7-afec7a75653d",
    "description": "An updated description"
  }'

Delete Agent

Delete an agent (soft delete - sets status to deleted).

http
DELETE /agent/delete
POST /agent/delete

Request Body:

json
{
  "agentId": "5a8f5c4f-a3ca-44cc-8fe7-afec7a75653d"
}

Chat Endpoints

Chat with Agent (Streaming) ⭐

Chat with an agent using real-time streaming responses.

http
POST /agent/{agentId}/chat

Request Body:

FieldTypeRequiredDescription
promptstringYesThe user's message
conversationIdstringNoUUID to continue existing conversation

Example:

bash
curl -N "https://stream.api.universalapi.co/agent/5a8f5c4f-a3ca-44cc-8fe7-afec7a75653d/chat" \
  -H "Content-Type: application/json" \
  -H "X-Uni-UserId: $USER_ID" \
  -H "X-Uni-SecretUniversalKey: $SECRET_KEY" \
  -d '{"prompt": "Hello! What is 2+2?"}'

Response (Streaming):

Content-Type: text/plain; charset=utf-8
X-Conversation-Id: 625c2112-9eac-4630-bbbc-785a845a182d

__META__{"conversationId": "625c2112-9eac-4630-bbbc-785a845a182d"}__
Hello! The answer to 2+2 is 4.

Response Markers:

MarkerDescription
__META__{json}__Metadata (conversationId)
__TOOL__{name}__Tool execution indicator
__ERROR__{json}__Error information

Timeout: 15 minutes (900 seconds)


Chat with Agent (GET - Browser Testing) 🌐

Chat with an agent via GET request for easy browser testing.

http
GET /agent/{agentId}/chat?prompt={message}&sessionId={optional-session-id}

Query Parameters:

ParameterRequiredDescription
promptYesThe user's message (URL encoded)
sessionIdNoUUID to continue existing conversation
conversationIdNoAlias for sessionId

Example (Browser URL):

https://stream.api.universalapi.co/agent/5a8f5c4f-a3ca-44cc-8fe7-afec7a75653d/chat?prompt=Hello!%20What%20is%202%2B2?

Example (curl):

bash
curl -N "https://stream.api.universalapi.co/agent/5a8f5c4f-a3ca-44cc-8fe7-afec7a75653d/chat?prompt=Hello" \
  -H "X-Uni-UserId: $USER_ID" \
  -H "X-Uni-SecretUniversalKey: $SECRET_KEY"

Browser Extension

Use a browser extension like "ModHeader" to add the X-Uni-UserId and X-Uni-SecretUniversalKey headers for testing directly in your browser.

Timeout: 15 minutes (900 seconds)


Chat with Agent (Buffered)

Chat with an agent using a buffered (complete) response.

http
POST /agent/{agentId}/chat

Request Body:

FieldTypeRequiredDescription
promptstringYesThe user's message
conversationIdstringNoUUID to continue existing conversation

Example:

bash
curl -X POST "https://api.universalapi.co/agent/5a8f5c4f-a3ca-44cc-8fe7-afec7a75653d/chat" \
  -H "Content-Type: application/json" \
  -H "X-Uni-UserId: $USER_ID" \
  -H "X-Uni-SecretUniversalKey: $SECRET_KEY" \
  -d '{"prompt": "Hello! What is 2+2?"}'

Timeout: 5 minutes (300 seconds)


Conversation Endpoints

List Conversations

List all conversations for an agent.

http
GET /agent/{agentId}/conversations

Example:

bash
curl "https://api.universalapi.co/agent/5a8f5c4f-a3ca-44cc-8fe7-afec7a75653d/conversations" \
  -H "X-Uni-UserId: $USER_ID" \
  -H "X-Uni-SecretUniversalKey: $SECRET_KEY"

Response:

json
{
  "conversations": [
    {
      "conversationId": "625c2112-9eac-4630-bbbc-785a845a182d",
      "agentId": "5a8f5c4f-a3ca-44cc-8fe7-afec7a75653d",
      "title": "Hello! What is 2+2?",
      "messageCount": 4,
      "createdAt": 1768666200000,
      "updatedAt": 1768666300000
    }
  ]
}

Get Conversation

Get the full message history of a conversation.

http
GET /agent/{agentId}/conversation/{conversationId}

Example:

bash
curl "https://api.universalapi.co/agent/5a8f5c4f-a3ca-44cc-8fe7-afec7a75653d/conversation/625c2112-9eac-4630-bbbc-785a845a182d" \
  -H "X-Uni-UserId: $USER_ID" \
  -H "X-Uni-SecretUniversalKey: $SECRET_KEY"

Response:

json
{
  "conversation": {
    "conversationId": "625c2112-9eac-4630-bbbc-785a845a182d",
    "agentId": "5a8f5c4f-a3ca-44cc-8fe7-afec7a75653d",
    "userId": "d468e4e8-50f1-705c-eab0-4b513b8b5900",
    "messages": [
      {
        "role": "user",
        "content": "Hello! What is 2+2?",
        "timestamp": 1768666200000
      },
      {
        "role": "assistant",
        "content": "Hello! The answer to 2+2 is 4.",
        "timestamp": 1768666201000
      }
    ],
    "createdAt": 1768666200000,
    "updatedAt": 1768666201000
  }
}

Error Responses

All errors follow this format:

json
{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message"
  }
}

Error Codes

CodeStatusDescription
AUTHENTICATION_REQUIRED401Missing or invalid credentials
AGENT_NOT_FOUND404Agent doesn't exist
AGENT_DELETED410Agent was deleted
ACCESS_DENIED403No permission to access agent
INVALID_PARAMETERS400Bad request body
AWS_CREDENTIALS_REQUIRED400No AWS Bedrock credentials configured
AGENT_EXECUTION_FAILED500Runtime error in agent code
CONVERSATION_NOT_FOUND404Conversation doesn't exist

Rate Limits

User TypeLimit
Authenticated60 requests/minute
AnonymousNot supported

Source Code Requirements

The sourceCode field must contain Python code that defines a create_agent() function:

python
def create_agent():
    """
    Create and return a Strands Agent.
    
    Returns:
        tuple: (agent, mcp_clients)
            - agent: The Strands Agent instance
            - mcp_clients: List of MCP client connections (can be empty)
    """
    from strands import Agent
    from strands.models import BedrockModel
    
    model = BedrockModel(
        model_id="us.anthropic.claude-3-7-sonnet-20250219-v1:0",
        region_name="us-east-1"
    )
    agent = Agent(model=model)
    
    return agent, []

Allowed Imports

For security, only these modules can be imported:

  • strands, strands.Agent, strands.tool
  • strands.models, strands.models.BedrockModel
  • strands_tools
  • json, datetime, time, uuid, typing, dataclasses
  • collections, itertools, functools, re, math, random
  • base64, hashlib, urllib.parse
  • boto3, botocore

Restricted Operations

The following are not allowed in agent code:

  • File system access (open, os.remove, etc.)
  • Shell execution (os.system, subprocess, etc.)
  • Network access outside of allowed tools
  • eval, exec, compile

Endpoint Summary

EndpointMethodDescription
/agent/createPOSTCreate a new agent
/agent/listGETList your agents
/agent/{agentId}GETGet agent details
/agent/updatePUT/POSTUpdate an agent
/agent/deleteDELETE/POSTDelete an agent
/agent/{agentId}/chatPOSTChat (buffered) — api.universalapi.co
/agent/{agentId}/chatPOSTChat (streaming) ⭐ — stream.api.universalapi.co
/agent/{agentId}/chatGETChat (browser testing) 🌐 — stream.api.universalapi.co
/agent/{agentId}/conversationsGETList conversations
/agent/{agentId}/conversation/{id}GETGet conversation

Universal API - The agentic entry point to the universe of APIs