Your First API Call
This guide walks you through making your first successful API request to VelaFlows. By the end, you’ll have listed your inbox conversations and understood the response format.
Step 1: Create an API Token
If you haven’t already, create an API token:
- Log in to app.velaflows.com
- Go to Settings > Developer > API Tokens
- Click Create Token
- Name it “My First Token” and select the
inbox:readscope - Click Create and copy the token
Step 2: Find Your Workspace ID
Your workspace ID is visible in:
- Settings > General in the dashboard
- The URL bar when you’re on any dashboard page
It’s a 24-character string like 64f1a2b3c4d5e6f7a8b9c0d1.
Step 3: Make Your First Request
Let’s list conversations in your inbox. Choose your preferred language:
cURL
curl -X GET "https://api.velaflows.com/api/v1/inbox/conversations?page=1&limit=5" \
-H "Authorization: Bearer sk_live_YOUR_TOKEN_HERE" \
-H "x-workspace-id: YOUR_WORKSPACE_ID" \
-H "Content-Type: application/json"JavaScript (fetch)
const VELAFLOWS_TOKEN = 'sk_live_YOUR_TOKEN_HERE'
const WORKSPACE_ID = 'YOUR_WORKSPACE_ID'
const response = await fetch(
'https://api.velaflows.com/api/v1/inbox/conversations?page=1&limit=5',
{
method: 'GET',
headers: {
'Authorization': `Bearer ${VELAFLOWS_TOKEN}`,
'x-workspace-id': WORKSPACE_ID,
'Content-Type': 'application/json',
},
}
)
const data = await response.json()
console.log(data)Python (requests)
import requests
VELAFLOWS_TOKEN = "sk_live_YOUR_TOKEN_HERE"
WORKSPACE_ID = "YOUR_WORKSPACE_ID"
response = requests.get(
"https://api.velaflows.com/api/v1/inbox/conversations",
headers={
"Authorization": f"Bearer {VELAFLOWS_TOKEN}",
"x-workspace-id": WORKSPACE_ID,
"Content-Type": "application/json",
},
params={"page": 1, "limit": 5},
)
data = response.json()
print(data)Step 4: Understand the Response
A successful response looks like this:
{
"success": true,
"data": {
"items": [
{
"_id": "65a1b2c3d4e5f6a7b8c9d0e1",
"workspaceId": "64f1a2b3c4d5e6f7a8b9c0d1",
"channelType": "whatsapp",
"status": "open",
"priority": "normal",
"assignedAgentId": "64f1a2b3c4d5e6f7a8b9c0d2",
"lastMessageAt": "2026-03-24T10:30:00.000Z",
"unreadCount": 2,
"createdAt": "2026-03-20T08:15:00.000Z",
"updatedAt": "2026-03-24T10:30:00.000Z"
}
],
"pagination": {
"page": 1,
"limit": 5,
"total": 42,
"totalPages": 9
}
}
}Response Structure
All VelaFlows API responses follow a consistent format:
| Field | Type | Description |
|---|---|---|
success | boolean | true if the request was successful |
data | object | The response payload |
data.items | array | List of resources (for paginated endpoints) |
data.pagination | object | Pagination metadata |
data.pagination.page | number | Current page number |
data.pagination.limit | number | Items per page |
data.pagination.total | number | Total items across all pages |
data.pagination.totalPages | number | Total number of pages |
For single-resource endpoints (e.g., get a specific conversation), the response
uses a named key instead of items:
{
"success": true,
"data": {
"conversation": { ... }
}
}Step 5: Handle Errors
If something goes wrong, the API returns an error response:
{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or expired token"
}
}Common Errors
| Status | Code | Meaning | Fix |
|---|---|---|---|
401 | UNAUTHORIZED | Bad or missing token | Check your Authorization header |
403 | FORBIDDEN | Insufficient permissions | Check your token’s scopes |
404 | NOT_FOUND | Resource doesn’t exist | Verify the endpoint path and IDs |
422 | VALIDATION_ERROR | Invalid request body | Check the details.errors array |
429 | TOO_MANY_REQUESTS | Rate limit exceeded | Wait and retry (see Rate Limits) |
What’s Next?
Now that you’ve made your first API call, explore more of the platform:
- API Reference — Full reference for all 34 services
- SDKs & Examples — Code examples in JavaScript, Python, and cURL
- Webhooks — Subscribe to real-time events instead of polling
- Rate Limits & Errors — Learn about rate limiting and backoff strategies