Skip to main content

Get Your API Key

Start by generating your API key from your workspace settings.
1

Access Workspace Settings

  1. Log into your SundayPyjamas workspace
  2. Navigate to SettingsAPI tab
  3. Click “Generate API Key”
  4. Give your key a descriptive name (optional)
2

Save Your Key Securely

Copy and store this key immediately - it won’t be shown again!

Make Your First Request

Choose your preferred method to make your first API call:

Understanding the Response

The API returns a streaming text response. You’ll receive the AI’s response in real-time:

Common Use Cases

Content Generation

Generate blog posts, emails, and marketing copy with custom prompts.

Chat Interface

Build conversational AI interfaces with streaming responses.

Email Writing

Create professional emails for various purposes and audiences.

Code Assistance

Get help with programming tasks and code generation.

Best Practices

Secure Your API Key

Handle Errors Gracefully

Optimize for Token Usage

Be concise and clear in your prompts to minimize token usage and costs.

Next Steps

Authentication Guide

Learn about API key management, security, and permissions.

Chat API Reference

Explore complete endpoint documentation with all parameters.

Code Examples

View ready-to-use implementations in multiple languages.

Rate Limits

Understand usage guidelines and optimization strategies.

Troubleshooting

  • Check your API key format: spj_ai_[64-characters]
  • Ensure the key is active and not deleted
  • Verify the Authorization header: Bearer spj_ai_...
  • Check your workspace usage in settings
  • Optimize prompts to use fewer tokens
  • Consider upgrading your plan
  • Verify the API URL is correct
  • Check your internet connection
  • Ensure HTTPS is used, not HTTP
Ready to build amazing AI-powered applications? Start with the Chat API documentation or explore our code examples to see what’s possible!