API Access Setup
If you want to programmatically access your workspace, you can create an API key. This guide explains how to obtain and manage API keys.
Obtain API Key
Step 1: Access API Key Management
- Enter your workspace
- Click the "API Keys" tab
Step 2: Create a New Key
Click the "Issue New" button.
Important
- The "Issue New API Key" dialog will display: "Create a new API key to access workspace resources. The complete key will only be displayed once."
- Be sure to copy and securely save the key immediately after creation.
Step 3: Configure the Key
Fill in the dialog:
- Key Name (required): Give the key an easily identifiable name (e.g., "Production", "Testing")
- If not filled, an error message "Please enter a key name" will be displayed
- Expiration Date (optional): Click the "Select expiration date" button to set the key's validity period
- Leave blank for no expiration
- Click the date picker button (with calendar icon) to select a date
Step 4: Issue and Save the Key
After clicking the "Issue Key" button, the system will display the complete API key.
Important
- The key will only be displayed once at creation. Please copy and save it immediately.
- If lost, you will need to create a new key.
Click the "Copy" button to copy the complete key, then click "Done".
Manage API Keys
View Created Keys
In the "API Keys" tab, you can see all created keys:
- Name: The key's identification name
- Key Prefix: The first few characters of the key (for identification)
- Created: The date the key was created
- Expires: The date the key expires (if set)
Revoke Keys
If a key is compromised or no longer needed:
- Find the key to revoke
- Click the "Revoke" button
- Confirm revocation
Note
After revocation, all requests using that key will fail. Make sure to update all applications using that key.
Security Best Practices
Protect Your Keys
- Do not use API keys in frontend code
- Do not commit keys to version control systems (like Git)
- Store keys using environment variables
- Use different keys for different environments (development, testing, production)
- Regularly review and revoke unused keys
Using Environment Variables
# .env file (do not commit to Git)
CODEER_API_KEY=your-api-key-here
# Python example
import os
api_key = os.environ.get('CODEER_API_KEY')
Set Expiration Times
We recommend setting reasonable expiration times for keys:
- Temporary Testing: Set for a few days or weeks
- Production Use: Set according to security policy, e.g., rotate quarterly
Using the API
After obtaining your API key, explore the API documentation:
- API Reference Overview - Base URL, authentication, and response format
- Chat API - Build chat integrations with your agents
- SSE Streaming - Real-time streaming responses
Official API Examples
For complete working examples, refer to the official example project: https://github.com/codeer-ai/codeer-api-examples
The examples include:
- Complete demonstration of Chat API
- Real-time streaming responses with Server-Sent Events (SSE)
- Multi-language examples in Python / PHP / JavaScript
- GET_APIKEY.md: Supplementary instructions for obtaining API keys
FAQ
What can API keys do?
API keys are used to programmatically access your workspace resources, including conversing with Agents, managing settings, etc.
What if I lose my key?
Keys cannot be recovered. Please revoke the lost key and create a new one.
Can I create multiple keys?
Yes. We recommend creating different keys for different purposes or environments for easier tracking and management.
What happens when a key expires?
After expiration, requests using that key will be rejected. You need to create a new key and update your applications.