Getting Started
Quick Start Guide
Learn how to integrate SurveyPro into your application
The SurveyPro API is organized around REST. Our API accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes and authentication.
npm install @surveypro/sdkAuthentication
API Keys
Authenticate your API requests using API keys
All API requests must include your API key in the headers:
fetch('https://surveyforms.melonelab.com/api/surveys', {
headers: {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_API_KEY'
}
})Surveys
Create a Survey
POST /api/surveys
const response = await fetch('https://surveyforms.melonelab.com/api/surveys', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
title: 'Customer Feedback',
description: 'Please share your thoughts',
questions: [
{
type: 'rating',
text: 'How satisfied are you?',
required: true
},
{
type: 'text',
text: 'Any additional feedback?'
}
]
})
});
const survey = await response.json();Get a Survey
GET /api/surveys/:id
const response = await fetch('https://surveyforms.melonelab.com/api/surveys/123', {
headers: {
'x-api-key': 'YOUR_API_KEY'
}
});
const survey = await response.json();Responses
Submit a Response
POST /api/surveys/:id/responses
const response = await fetch('https://surveyforms.melonelab.com/api/surveys/123/responses', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
answers: {
'q1': 5,
'q2': 'Great service!'
}
})
});
const result = await response.json();Webhooks
Configure Webhooks
Receive real-time notifications for survey events
Webhooks allow you to receive real-time notifications when events occur in your account.
// Example webhook payload
{
"event": "response.created",
"surveyId": "123",
"responseId": "456",
"createdAt": "2024-02-27T12:00:00Z",
"data": {
"answers": {
"q1": 5,
"q2": "Great service!"
}
}
}Rate Limits
API Rate Limits
Understanding rate limits and quotas
Rate limits vary by plan:
- Free: 100 requests per minute
- Pro: 1,000 requests per minute
- Enterprise: Custom limits
Rate limit headers are included in all API responses:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1519839340