Surveys API
List Surveys
GET /api/surveys?workspace_id={id}
Returns all surveys in the specified workspace.
Query Parameters:
| Name | Type | Description |
|---|---|---|
workspace_id |
integer | Workspace to filter by |
Example:
curl -H "X-API-Key: tp_your_key" \
"https://tabularpro.com/api/surveys?workspace_id=1"
Response:
{
"success": 1,
"data": [
{
"survey_id": 1,
"survey_name": "Customer Satisfaction Q2",
"survey_description": "Quarterly satisfaction survey",
"survey_status": 2,
"survey_type": "quantitative",
"response_count": 1247,
"workspace_id": 1,
"survey_inserted": "2025-01-15T10:00:00.000Z",
"survey_updated": "2025-03-20T14:30:00.000Z"
}
]
}
Get Survey
GET /api/surveys/:id
Returns a survey with its full structure including pages and questions.
Example:
curl -H "X-API-Key: tp_your_key" \
https://tabularpro.com/api/surveys/1
Create Survey
POST /api/surveys
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
survey_name |
string | Yes | Survey title |
survey_description |
string | No | Survey description |
workspace_id |
integer | No | Target workspace |
Example:
curl -X POST \
-H "X-API-Key: tp_your_key" \
-H "Content-Type: application/json" \
-d '{"survey_name": "Product Feedback", "survey_description": "Monthly product feedback survey"}' \
https://tabularpro.com/api/surveys
Response: 201 Created
{
"success": 1,
"data": {
"survey_id": 42,
"survey_name": "Product Feedback",
"survey_status": 1
}
}
Update Survey
PUT /api/surveys/:id
Request Body: Any survey fields to update.
curl -X PUT \
-H "X-API-Key: tp_your_key" \
-H "Content-Type: application/json" \
-d '{"survey_name": "Product Feedback - March 2025"}' \
https://tabularpro.com/api/surveys/42
Delete Survey
DELETE /api/surveys/:id
Returns 204 No Content on success.
curl -X DELETE \
-H "X-API-Key: tp_your_key" \
https://tabularpro.com/api/surveys/42
Duplicate Survey
POST /api/surveys/:id/duplicate
Creates a complete copy of a survey including all pages, questions, and settings.
curl -X POST \
-H "X-API-Key: tp_your_key" \
https://tabularpro.com/api/surveys/1/duplicate
Publish Survey
POST /api/surveys/:id/publish
Publishes a survey, making it available for data collection. Generates distribution links.
curl -X POST \
-H "X-API-Key: tp_your_key" \
https://tabularpro.com/api/surveys/1/publish
Export Survey
GET /api/surveys/:id/export
Exports the survey definition (structure, questions, logic) as JSON.
Import Survey
POST /api/surveys/import
Imports a survey from an exported JSON definition.
Request Body: The exported survey JSON object.
Survey Status Values
| Status | Meaning |
|---|---|
1 |
Draft — not yet published |
2 |
Active — accepting responses |
3 |
Closed — no longer accepting responses |
0 |
Deleted |