How to Use the Spur API and Swagger Environment
The UI can only take you so far. That's why we have the Spur API. Docs here.
This guide covers:
How to generate an API key
How to authenticate your API calls (Bearer Authentication)
How to use the Swagger UI for testing
How to send messages via cURL (text and templates)
Converting Swagger requests to cURL
Step 1: Generate an API Key
Before you can make any API calls, you need an API key.
Go to Settings > API Settings in your Spur dashboard
Click Generate New API Key
Copy the key somewhere safe - you won't be able to see it again
For detailed steps, check this guide.
Step 2: Authenticate Your API Calls (Bearer Authentication)
When calling the Spur API from your code, workflows, or any external system, you need to include your API key in the request headers.
Authentication Format
Header Name: Authorization
βHeader Value: Bearer <YOUR_API_KEY>
Replace <YOUR_API_KEY> with the actual API key you generated.
Example
If your API key is spur_abc123xyz, your header would look like:
Authorization: Bearer spur_abc123xyz
This applies to all API requests you make outside of the Swagger UI - whether it's from code, automation tools like Make/Zapier, or the Flow Builder's HTTP request block.
Step 3: How to Use the Swagger UI
The Swagger UI lets you test API endpoints directly in your browser before writing any code.
Open the API Documentation
You'll see the interactive Swagger documentation:
Authorize in Swagger
Click the Authorize button at the top right
Paste your API key in the field
Click Authorize then Close
Note: In Swagger UI, just paste the key directly - no need to add "Bearer" prefix.
Test an Endpoint
Find the API endpoint you want to test
Click Try it out
Fill in the required parameters or request body
Hit Execute
Check the response below
Step 4: Send a Text Message via API
Now let's look at how to actually send messages using cURL. These examples work from terminal, code, or any HTTP client.
Send a Text Message on WhatsApp
bash
curl --request POST \
--url https://api.spurnow.com/send-message \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"channel": "whatsapp",
"to": "917032226768",
"content": {
"recipient_type": "individual",
"type": "text",
"text": {
"preview_url": true,
"body": "Hey, this is a test message from Spur API"
}
}
}'
Key fields:
channel: Set to"whatsapp"to: Phone number with country code (no + sign)type: Set to"text"for plain messagesbody: Your message text
Send a Text Message on Instagram
bash
curl --request POST \
--url https://api.spurnow.com/send-message \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"channel": "instagram",
"to": "instagram_user_id_here",
"content": {
"recipient_type": "individual",
"type": "text",
"text": {
"body": "Thanks for reaching out! How can we help?"
}
}
}'
Key difference:
channel: Set to"instagram"to: Use Instagram user ID (not username)
Step 5: Send a Template Message on WhatsApp
Template messages are pre-approved message formats you can send for notifications, updates, or marketing.
bash
curl --request POST \
--url https://api.spurnow.com/send-message \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"channel": "whatsapp",
"to": "917032226768",
"content": {
"recipient_type": "individual",
"type": "template",
"template": {
"name": "order_confirmation",
"language": {
"code": "en"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "John"
},
{
"type": "text",
"text": "ORD-12345"
}
]
}
]
}
}
}'
Key fields:
type: Set to"template"name: Your template name (must be approved in Meta Business Manager)language: Template language codecomponents: Template variables/parameters
Note: Templates must be created and approved through Meta Business Manager before you can send them via API.
Step 6: Convert Swagger Requests to cURL
If you're testing in Swagger and want to grab the exact cURL command:
Open browser DevTools (press F12 or Fn + F12)
Go to the Network tab
Clear any existing requests (click the π« icon)
Execute your request in Swagger
Find the request in the Network tab
Right-click it and select Copy > Copy as cURL
You'll get a complete cURL command with all headers and data included.
Need More API Endpoints?
The examples above cover the most common use cases - sending text and template messages.
For the full list of available APIs (contacts, broadcasts, flows, webhooks, etc.), check out the complete documentation at https://api.spurnow.com/docs.
If there's an API you need that isn't documented, create a feature request here.
Quick Troubleshooting
Getting "Unauthorized" errors?
Make sure you're including the
Authorizationheader with valueBearer YOUR_API_KEYCheck that your API key is active and not expired
Verify you copied the entire key correctly (no extra spaces)
Message not sending?
Confirm the phone number format (country code without + sign)
Check that your WhatsApp number is connected in Spur
For templates, make sure the template is approved in Meta Business Manager
Still stuck? Reach out to support via chat and we'll help you get it working.






