How to Integrate and Manage Partners in the Claude API Ecosystem
A practical guide to understanding and working with partner integrations in the Claude API, including setup, authentication, and best practices for collaborative workflows.
This guide explains how to set up and manage partner integrations with the Claude API, covering authentication, API key sharing, and practical code examples for building multi-user applications.
Introduction
When building applications with Claude AI, you often need to collaborate with external developers, agencies, or service providers. Anthropic’s partner ecosystem allows you to securely share API access, manage permissions, and integrate Claude’s capabilities into third-party platforms. This guide walks you through the practical steps to set up and manage partner integrations in the Claude API ecosystem.
Whether you are a solo developer onboarding a freelancer or a team lead managing multiple integrations, understanding the partner workflow is essential for maintaining security and efficiency.
Understanding the Partner Model
Anthropic’s partner model is designed for controlled access. Instead of sharing your primary API key, you can create partner-specific credentials or use organizational accounts to delegate permissions. This ensures:
- Security: Partners only access the resources they need.
- Auditability: You can track usage per partner.
- Flexibility: Revoke access without affecting your own workflows.
Key Concepts
- Primary API Key: Your master key with full access. Never share this directly.
- Partner API Key: A scoped key with limited permissions, generated for a specific partner.
- Organization Roles: In team accounts, you can assign roles like Admin, Member, or Billing to partners.
Setting Up a Partner Integration
Step 1: Create a Partner API Key
- Log in to the Anthropic Console.
- Navigate to API Keys > Partner Keys.
- Click Create Partner Key.
- Provide a name (e.g., "Freelance Developer - Jane") and set permissions:
- Copy the generated key and share it securely with your partner.
Step 2: Partner Uses the Key
Your partner can now use this key in their API calls. Here’s a Python example:
import anthropic
client = anthropic.Anthropic(
api_key="sk-ant-partner-xxxxxxxxxxxxx" # Partner-specific key
)
message = client.messages.create(
model="claude-3-sonnet-20240229",
max_tokens=1000,
messages=[
{"role": "user", "content": "Hello, Claude!"}
]
)
print(message.content)
The partner does not need to know your primary key. All usage is tracked under your account but attributed to the partner key.
Managing Multiple Partners
If you work with several partners (e.g., a UI/UX agency, a backend developer, and a QA team), you can create separate keys for each. This allows you to:
- Monitor usage per partner via the console’s Usage tab.
- Revoke a single key if a partnership ends.
- Adjust rate limits individually.
Example: TypeScript with Multiple Keys
import Anthropic from '@anthropic-ai/sdk';
const partnerKeys = {
agency: 'sk-ant-partner-xxxx-agency',
backend: 'sk-ant-partner-xxxx-backend',
qa: 'sk-ant-partner-xxxx-qa'
};
async function callClaude(partner: keyof typeof partnerKeys, prompt: string) {
const client = new Anthropic({ apiKey: partnerKeys[partner] });
const response = await client.messages.create({
model: 'claude-3-haiku-20240307',
max_tokens: 500,
messages: [{ role: 'user', content: prompt }]
});
return response.content;
}
// Usage
callClaude('agency', 'Design a landing page layout');
Best Practices for Partner Integrations
1. Use Scoped Permissions
Always grant the minimum permissions necessary. For example, if a partner only needs to generate text, restrict access to the messages.create endpoint and limit model choices.
2. Rotate Keys Regularly
Set expiration dates on partner keys. For long-term partnerships, rotate keys every 90 days. This reduces the risk of leaked keys.
3. Monitor Usage Alerts
In the Anthropic Console, set up usage alerts per partner key. You’ll receive email notifications when usage exceeds a threshold (e.g., 80% of your budget).
4. Secure Key Transmission
Never send API keys via email or chat. Use a secure sharing tool like:
- LastPass or 1Password (shared vaults)
- GitHub Secrets (for CI/CD pipelines)
- Environment variables in your deployment platform
5. Document the Integration
Provide your partner with clear documentation on:
- Which endpoints they can use
- Expected request/response formats
- Rate limits and error handling
import anthropic
from anthropic import APIError, APIConnectionError, RateLimitError
client = anthropic.Anthropic(api_key="sk-ant-partner-xxx")
try:
response = client.messages.create(
model="claude-3-sonnet-20240229",
max_tokens=1000,
messages=[{"role": "user", "content": "Hello"}]
)
print(response.content)
except RateLimitError:
print("Rate limit exceeded. Please wait and retry.")
except APIConnectionError:
print("Network error. Check your internet connection.")
except APIError as e:
print(f"API error: {e}")
Troubleshooting Common Issues
| Issue | Likely Cause | Solution |
|---|---|---|
401 Unauthorized | Invalid or expired partner key | Regenerate the key in the console |
429 Too Many Requests | Rate limit exceeded | Wait or request higher limits |
403 Forbidden | Key lacks permission for the model | Update permissions in the console |
| Partner sees your usage data | Key has admin-level access | Create a new key with read-only or limited scope |
Advanced: Automating Partner Key Management
For large-scale operations, you can manage partner keys programmatically using the Anthropic Admin API (if available in your plan). Here’s a conceptual example:
import requests
admin_api_key = "sk-ant-admin-xxxx"
headers = {"x-api-key": admin_api_key, "Content-Type": "application/json"}
Create a new partner key
payload = {
"name": "QA Team Key",
"permissions": {
"models": ["claude-3-haiku-20240307"],
"rate_limits": {"rpm": 100, "tpm": 50000}
},
"expires_at": "2025-12-31T23:59:59Z"
}
response = requests.post(
"https://api.anthropic.com/v1/admin/partner-keys",
headers=headers,
json=payload
)
if response.status_code == 201:
print(f"Partner key created: {response.json()['key']}")
else:
print(f"Error: {response.text}")
Note: The Admin API is available for Enterprise plans. Check Anthropic’s documentation for the latest endpoints.
Conclusion
Partner integrations in the Claude API ecosystem are straightforward to set up and manage. By using scoped API keys, monitoring usage, and following security best practices, you can collaborate with external teams without compromising your account’s safety.
Remember: the goal is to enable collaboration while maintaining control. Start with a single partner key, test the workflow, and scale as your needs grow.
Key Takeaways
- Never share your primary API key – always generate partner-specific keys with limited permissions.
- Use the Anthropic Console to create, monitor, and revoke partner keys as needed.
- Set rate limits and expiration dates on partner keys to prevent unexpected usage.
- Handle errors gracefully in your partner’s code to avoid service disruptions.
- Automate key management with the Admin API for large-scale or enterprise deployments.