Quick Start
This guide will help you make your first Semaswift API call in under 5 minutes.
Prerequisites
- A Semaswift account (sign up at semaswift.com)
- Your API credentials (JWT token or Personal Access Token)
- A tool for making HTTP requests (curl, Postman, or your favorite HTTP client)
Step 1: Get Your API Token
Option A: Login to Get JWT Token
curl -X POST https://api.semaswift.com/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "your-email@example.com",
"password": "your-password"
}'
Response:
{
"access_token": "eyJhbGciOiJSUzI1NiIs...",
"refresh_token": "eyJhbGciOiJSUzI1NiIs...",
"token_type": "Bearer",
"expires_in": 3600,
"user": {
"id": "usr_123456",
"email": "your-email@example.com",
"name": "Your Name"
}
}
Option B: Use a Personal Access Token
Generate a PAT from your dashboard at Settings > API Keys.
Step 2: Make Your First API Call
Use your token to fetch your user profile:
curl https://api.semaswift.com/api/v1/auth/me \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response:
{
"id": "usr_123456",
"email": "your-email@example.com",
"name": "Your Name",
"organization_id": "org_789",
"roles": ["admin"],
"created_at": "2024-01-15T10:30:00Z"
}
Step 3: Explore the API
Now that you're authenticated, try some common operations:
List Users in Your Organization
curl https://api.semaswift.com/api/v1/users \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Create a Support Ticket
curl -X POST https://api.semaswift.com/api/v1/tickets \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"subject": "Test Ticket",
"description": "This is a test ticket created via API",
"priority": "medium"
}'
List Available Call Queues
curl https://api.semaswift.com/api/v2/voice/queues \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Using Different Languages
- cURL
- JavaScript
- Python
- Go
curl https://api.semaswift.com/api/v1/auth/me \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
const response = await fetch('https://api.semaswift.com/api/v1/auth/me', {
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
});
const user = await response.json();
console.log(user);
import requests
response = requests.get(
'https://api.semaswift.com/api/v1/auth/me',
headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}
)
user = response.json()
print(user)
req, _ := http.NewRequest("GET", "https://api.semaswift.com/api/v1/auth/me", nil)
req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var user map[string]interface{}
json.NewDecoder(resp.Body).Decode(&user)
Base URLs
| Environment | Base URL |
|---|---|
| Production | https://api.semaswift.com |
| Sandbox | https://sandbox.semaswift.com |
| Local Development | http://localhost:3000 |
Next Steps
- Learn about Authentication in detail
- Understand Making Requests
- Explore the API Reference