API Reference
Complete reference for the TryAPI REST API.
Last updated: December 10, 2024
Authentication
All API requests require authentication using an API key. Include your API key in the Authorization header:
Authorization: Bearer your_api_keyGetting Your API Key
You can generate API keys from your dashboard settings. Keep your API keys secure and never expose them in client-side code.
Playgrounds API
List Playgrounds
GET /api/playgroundsReturns a paginated list of your playgrounds.
Query Parameters:
page(optional): Page number, defaults to 1limit(optional): Items per page, defaults to 20search(optional): Search playgrounds by name
Get Playground
GET /api/playgrounds/:idRetrieves a single playground by ID.
Create Playground
POST /api/playgroundsCreates a new playground.
Request Body:
{
"name": "My API Playground",
"curl_command": "curl https://api.example.com/users",
"is_public": false,
"theme": "dark",
"languages": ["python", "javascript", "curl"]
}Update Playground
PATCH /api/playgrounds/:idUpdates an existing playground.
Delete Playground
DELETE /api/playgrounds/:idPermanently deletes a playground.
Tests API
Execute Test
POST /api/tests/executeExecutes an API request through our proxy.
Request Body:
{
"method": "POST",
"url": "https://api.example.com/users",
"headers": {
"Authorization": "Bearer token",
"Content-Type": "application/json"
},
"body": {
"name": "Test User"
}
}List Test History
GET /api/tests?playgroundId=xxxReturns the test history for a playground.
Get Test Result
GET /api/tests/:idRetrieves a specific test result.
Code Generation
Generate Code
POST /api/generate-codeGenerates code snippets from a parsed cURL command.
Request Body:
{
"parsed": {
"method": "GET",
"url": "https://api.example.com/users",
"headers": {}
},
"language": "python"
}Supported Languages: python, javascript, curl, go, ruby, php, java, csharp, rust
cURL Parsing
Parse cURL
POST /api/parse-curlParses a cURL command into a structured format.
Request Body:
{
"curl": "curl -X POST https://api.example.com/users -H 'Authorization: Bearer token'"
}Rate Limits
API rate limits depend on your plan:
- Starter: 1,000 requests/day
- Pro: 10,000 requests/day
- Enterprise: Custom limits
Rate limit headers are included in all responses:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1702252800Errors
The API uses standard HTTP status codes. Error responses include a JSON body:
{
"error": {
"code": "invalid_request",
"message": "The curl_command field is required"
}
}Common Error Codes:
400- Bad Request (invalid parameters)401- Unauthorized (missing or invalid API key)403- Forbidden (insufficient permissions)404- Not Found (resource doesn't exist)429- Too Many Requests (rate limit exceeded)500- Internal Server Error
SDKs
Official SDKs are available for popular languages. See our SDK documentation for installation and usage instructions.