Skip to main content

Your First API Call

The basic Shannon workflow is simple: submit a task, get a task ID, check the status, and retrieve the result.

Complete Example (cURL)

Expected Output:

Common API Patterns

1. Submit → Poll → Retrieve

The standard workflow for any task:

2. Multi-Turn Conversations (Sessions)

Use the same session_id to maintain context across multiple tasks:

3. Real-Time Streaming (SSE)

Get live updates instead of polling:

4. Error Handling

Always handle errors gracefully:

Authentication Setup

Getting Your API Key

1

Development Mode (Skip Auth)

For local testing, you can disable authentication:
Then use any placeholder key:
2

Production Mode (Real API Keys)

Generate an API key from your Shannon dashboard:
  1. Log in to Shannon Cloud
  2. Navigate to Settings → API Keys
  3. Click “Create API Key”
  4. Copy the key (starts with sk_)
Store it securely (e.g., environment variable):

Including the API Key

Always include your API key in the X-API-Key header:
Never commit API keys to version control. Use environment variables or secret management tools.

Complete Workflow Example

Here’s a real-world example that combines all patterns:

Next Steps

Now that you know the basics, explore more advanced features:

Full API Reference

Complete documentation for all endpoints

Agents Catalog

Pre-built agents for specific tasks

Python SDK

Official Python client library

Streaming API

Real-time event streaming with SSE

Common Questions

Poll the GET /api/v1/tasks/{id} endpoint until status is TASK_STATUS_COMPLETED or TASK_STATUS_FAILED. For long-running tasks, use streaming instead of polling.
  • result is the raw text output from the LLM
  • response is only present if result contains valid JSON (parsed automatically)
Most of the time, you’ll use result.
Sessions persist for 30 days by default. All tasks with the same session_id share conversation history.
Yes, use POST /api/v1/tasks/{id}/cancel. The task will stop at the next safe checkpoint.
Streaming provides real-time updates with lower latency and less server load. Use it for long-running tasks or when you need immediate feedback.

Troubleshooting

401 Unauthorized

  • Check your API key is correct
  • Verify you’re using the X-API-Key header (not Authorization)
  • In dev mode, ensure GATEWAY_SKIP_AUTH=1 is set

429 Rate Limited

  • Check the Retry-After header
  • Implement exponential backoff
  • Upgrade your API tier for higher limits

Task stuck in RUNNING

  • Wait longer (complex tasks take time)
  • Use streaming to see progress
  • Check Temporal UI for detailed workflow status

Empty result field

  • Task might still be running (check status)
  • Task failed (check error field)
  • Use streaming to see intermediate output