Skip to navigation

Getting Started

Make your first API call in under 5 minutes
1

Get your API key

API keys are provisioned by your Pyramid AI account manager during pilot onboarding. You’ll receive a key with the prefix:

  • pai_live_* for production
  • pai_test_* for staging/sandbox

Store your API key securely. It is shown only once at creation time and cannot be retrieved later. If lost, request a key rotation from your admin.

2

Verify your connection

Test that your key works by calling the organization endpoint:

curl https://api-staging.pyramid-ai.com/api/v2/organization \
-H "Authorization: Bearer pai_test_YOUR_KEY_HERE"

A successful response:

{
"success": true,
"data": {
"id": "org_abc123",
"name": "Your Organization"
},
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
3

Create a project

Projects are containers for your documents and knowledge base.

curl -X POST https://api-staging.pyramid-ai.com/api/v2/projects \
-H "Authorization: Bearer pai_test_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{"name": "My First Project", "description": "Testing the API"}'
4

Upload a document

Document upload is a 3-step process: reserve, upload bytes, then trigger processing.

# Step 1: Reserve an upload slot
curl -X POST https://api-staging.pyramid-ai.com/api/v2/documents \
-H "Authorization: Bearer pai_test_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"file_name": "report.pdf",
"content_type": "application/pdf",
"size_bytes": 1048576,
"project_id": "YOUR_PROJECT_ID"
}'
# Step 2: Upload the file to the presigned URL from step 1
curl -X PUT "PRESIGNED_URL_FROM_STEP_1" \
-H "Content-Type: application/pdf" \
--data-binary @report.pdf
# Step 3: Trigger processing
curl -X POST https://api-staging.pyramid-ai.com/api/v2/documents/process \
-H "Authorization: Bearer pai_test_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{"document_ids": ["DOCUMENT_ID_FROM_STEP_1"]}'
5

Ask a question

Once your documents are processed, query your knowledge base:

curl -X POST https://api-staging.pyramid-ai.com/api/v2/agent/query \
-H "Authorization: Bearer pai_test_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"project_id": "YOUR_PROJECT_ID",
"query": "What are the main findings in the report?"
}'
{
"success": true,
"data": {
"answer": "Based on the project documents...",
"sources": [
{
"id": "chunk_abc",
"title": "report.pdf",
"relevance": 0.95
}
],
"model": "gpt-4.1",
"usage": {
"prompt_tokens": 1200,
"completion_tokens": 350
}
},
"request_id": "..."
}

Response envelope

Every API response uses a consistent envelope:

// Success
{
"success": true,
"data": { ... },
"request_id": "uuid"
}
// Error
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "project_id is required"
},
"request_id": "uuid"
}

The request_id is also returned in the X-Request-Id response header. Include it when contacting support.

Next steps