Skip to content

Getting Started with Octagon Agents API

Quick Start

1. Get an API Key

To use the Octagon Agents API, you'll need a free API key. You can get one by:

  1. Signing up for an Octagon account
  2. Go to the Settings page
  3. Navigate to the API Keys section
  4. Create a new API key

2. Make Your First API Call

Here's how to analyze SEC filings using different programming languages:

Python
from openai import OpenAI

client = OpenAI(
    # Note: Replace with your API key or use environment variables
    api_key="your-octagon-api-key",
    base_url="https://api-gateway.octagonagents.com/v1"
)

# Make the API call using the responses endpoint
response = client.responses.create(
    model="octagon-sec-agent",
    instructions="You analyze SEC filings and extract financial data.",
    input="What were Apple's revenue numbers in Q3 2023?"
)

# Extract and print the analysis text
analysis_text = response.output[0].content[0].text
print("ANALYSIS:")
print(analysis_text)

# Extract and print citations
annotations = response.output[0].content[0].annotations
print("\nSOURCES:")
for annotation in annotations:
    print(f"{annotation.order}. {annotation.name}: {annotation.url}")

# Example output:

# ANALYSIS:
# In the third quarter of 2023, Apple's total net sales were $81,797 million. This included $60,584 million from products and $21,213 million from services [1], [2].

# SOURCES:
# 1. Apple Inc. (10-Q) - 2023-Q3, Page: 10: https://octagon-sec-filings.s3.amazonaws.com/320193/0000320193-23-000077/aapl-20230701.pdf?response-content-disposition=inline&response-content-type=application%2Fpdf&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAYGEZZN2EGRGVN56Y%2F20250401%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250401T220525Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=783c748f003e66bbdb61b2da4b49e3a31da0213617ff2237d1316da2885ca515#page=10
# 2. Apple Inc. (10-Q) - 2023-Q3, Page: 4: https://octagon-sec-filings.s3.amazonaws.com/320193/0000320193-23-000077/aapl-20230701.pdf?response-content-disposition=inline&response-content-type=application%2Fpdf&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAYGEZZN2EGRGVN56Y%2F20250401%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250401T220525Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=783c748f003e66bbdb61b2da4b49e3a31da0213617ff2237d1316da2885ca515#page=4
JavaScript
import OpenAI from 'openai';

const client = new OpenAI({
  // Note: Replace with your API key or use environment variables
  apiKey: 'your-octagon-api-key',
  baseURL: 'https://api-gateway.octagonagents.com/v1'
});

async function getAnalysis() {
  // Make the API call using the responses endpoint
  const response = await client.responses.create({
    model: "octagon-sec-agent",
    instructions: "You analyze SEC filings and extract financial data.",
    input: "What were Apple's revenue numbers in Q3 2023?"
  });

  // Extract and print the analysis text
  const analysisText = response.output[0].content[0].text;
  console.log("ANALYSIS:");
  console.log(analysisText);

  // Extract and print citations
  const annotations = response.output[0].content[0].annotations;
  console.log("\nSOURCES:");
  annotations.forEach(annotation => {
    console.log(`${annotation.order}. ${annotation.name}: ${annotation.url}`);
  });
}

getAnalysis();

// Example output:

// ANALYSIS:
// In the third quarter of 2023, Apple's total net sales were $81,797 million. This included $60,584 million from products and $21,213 million from services [1], [2].

// SOURCES:
// 1. Apple Inc. (10-Q) - 2023-Q3, Page: 10: https://octagon-sec-filings.s3.amazonaws.com/320193/0000320193-23-000077/aapl-20230701.pdf?response-content-disposition=inline&response-content-type=application%2Fpdf&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAYGEZZN2EGRGVN56Y%2F20250401%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250401T220525Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=783c748f003e66bbdb61b2da4b49e3a31da0213617ff2237d1316da2885ca515#page=10
// 2. Apple Inc. (10-Q) - 2023-Q3, Page: 4: https://octagon-sec-filings.s3.amazonaws.com/320193/0000320193-23-000077/aapl-20230701.pdf?response-content-disposition=inline&response-content-type=application%2Fpdf&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAYGEZZN2EGRGVN56Y%2F20250401%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250401T220525Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=783c748f003e66bbdb61b2da4b49e3a31da0213617ff2237d1316da2885ca515#page=4
cURL
curl -X POST https://api-gateway.octagonagents.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-octagon-api-key" \
  -d '{
    "model": "octagon-sec-agent",
    "instructions": "You analyze SEC filings and extract financial data.",
    "input": "What were Apple'\''s revenue numbers in Q3 2023?"
  }'

Next Steps

Support

If you need help with the Octagon Agents API, you can: