cURL Examples

Complete cURL command examples for testing Skej Studio API endpoints

Setup

Set environment variables for easier testing

# Set your Service Key
export STUDIO_SERVICE_KEY="sk_live_your_service_key_here"

# Set your Tenant ID
export STUDIO_TENANT_ID="tenant_123"

# Test authentication
curl -H "Authorization: Bearer $STUDIO_SERVICE_KEY" \
  https://api.staging.agnt.ai/tenants/$STUDIO_TENANT_ID/prompts

List Prompts

Basic Request:

curl -X GET \
  'https://api.staging.agnt.ai/tenants/tenant_123/prompts' \
  -H 'Authorization: Bearer sk_live_your_service_key_here' \
  -H 'Content-Type: application/json'

With Pagination & Search:

curl -X GET \
  'https://api.staging.agnt.ai/tenants/tenant_123/prompts?page=1&per_page=20&search=customer' \
  -H 'Authorization: Bearer sk_live_your_service_key_here' \
  -H 'Content-Type: application/json'

Get Prompt Details

curl -X GET \
  'https://api.staging.agnt.ai/tenants/tenant_123/prompts/customer_support_agent' \
  -H 'Authorization: Bearer sk_live_your_service_key_here' \
  -H 'Content-Type: application/json'

Create a Prompt

curl -X POST \
  'https://api.staging.agnt.ai/tenants/tenant_123/prompts' \
  -H 'Authorization: Bearer sk_live_your_service_key_here' \
  -H 'Content-Type: application/json' \
  -d '{
    "promptName": "customer_support_agent",
    "displayName": "Customer Support Agent",
    "description": "Handles customer inquiries and support tickets",
    "template": "You are a helpful customer support agent...",
    "category": "Support",
    "variables": ["customer_name", "issue_type"]
  }'

Update a Prompt

curl -X PUT \
  'https://api.staging.agnt.ai/tenants/tenant_123/prompts/customer_support_agent' \
  -H 'Authorization: Bearer sk_live_your_service_key_here' \
  -H 'Content-Type: application/json' \
  -d '{
    "description": "Updated description",
    "template": "You are an expert customer support agent..."
  }'

Delete a Prompt

curl -X DELETE \
  'https://api.staging.agnt.ai/tenants/tenant_123/prompts/customer_support_agent' \
  -H 'Authorization: Bearer sk_live_your_service_key_here'

Get Activity Traces

curl -X GET \
  'https://api.staging.agnt.ai/tenants/tenant_123/traces?page=1&per_page=10' \
  -H 'Authorization: Bearer sk_live_your_service_key_here' \
  -H 'Content-Type: application/json'

Create Service Key

curl -X POST \
  'https://api.staging.agnt.ai/tenants/tenant_123/service-keys' \
  -H 'Authorization: Bearer sk_live_your_service_key_here' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Production API Key",
    "scopes": ["prompts:read", "prompts:write", "traces:read"],
    "expiresInDays": 90
  }'

Pretty Print JSON Response

Use jq to format JSON output

# Install jq (if not already installed)
# macOS: brew install jq
# Ubuntu: sudo apt-get install jq

# Pretty print API response
curl -X GET \
  'https://api.staging.agnt.ai/tenants/tenant_123/prompts' \
  -H 'Authorization: Bearer sk_live_your_service_key_here' \
  | jq '.'

# Extract specific fields
curl -X GET \
  'https://api.staging.agnt.ai/tenants/tenant_123/prompts' \
  -H 'Authorization: Bearer sk_live_your_service_key_here' \
  | jq '.data[] | {name: .promptName, display: .displayName}'