API Access
Learn how to access and retrieve survey responses using the Opineeo API.
Overview
Opineeo provides a RESTful API to retrieve survey responses, manage surveys, and access analytics. This guide covers how to authenticate and access your survey data programmatically.
Authentication
All API requests require authentication using your API token. You can find your API token in the Opineeo Dashboard.
Authentication Methods
Bearer Token
Include your API token in the Authorization header:
curl -X GET https://app.opineeo.com/api/survey/v0/results \ -H "Authorization: Bearer your-api-token"
API Key Parameter
Alternatively, pass the token as a query parameter:
curl -X GET "https://app.opineeo.com/api/survey/v0/results?surveyId=surveyid"
Base URL
All API endpoints are relative to:
https://app.opineeo.com/api/survey/v0/results
Endpoints
Get Single Response
Retrieve a specific response by ID.
Endpoint: GET /responses/{responseId}
Example Request:
curl -X GET "https://app.opineeo.com/api/survey/v0/results?surveyId=surveyid" \ -H "Authorization: Bearer your-api-token"
Example Response:
{ "success": true, "data": { "id": "resp_xyz789", "surveyId": "srv_abc123", "userId": "user-123", "completedAt": "2025-10-13T10:30:00Z", "answers": [...] } }
Code Examples
JavaScript/Node.js
const axios = require('axios') const API_TOKEN = 'your-api-token' const SURVEY_ID = 'srv_abc123' // Get survey responses async function getSurveyResponses() { try { const response = await axios.get( `https://app.opineeo.com/api/survey/v0/results?surveyId=${SURVEY_ID}`, { headers: { 'Authorization': `Bearer ${API_TOKEN}` } } ) console.log('Responses:', response.data) return response.data } catch (error) { console.error('Error:', error.response.data) } } getSurveyResponses()
Python
import requests API_TOKEN = 'your-api-token' SURVEY_ID = 'srv_abc123' def get_survey_responses(): url = f'https://app.opineeo.com/api/survey/v0/results?surveyId={SURVEY_ID}' headers = { 'Authorization': f'Bearer {API_TOKEN}' } params = { 'limit': 50, 'offset': 0 } response = requests.get(url, headers=headers, params=params) if response.status_code == 200: data = response.json() print('Responses:', data) return data else: print('Error:', response.json()) get_survey_responses()
PHP
<?php $apiToken = 'your-api-token'; $surveyId = 'srv_abc123'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://app.opineeo.com/api/survey/v0/results?surveyId=$SURVEY_ID"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "Authorization: Bearer $apiToken" ]); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true); print_r($data); ?>
React/Next.js
const API_TOKEN = process.env.NEXT_PUBLIC_OPINEEO_TOKEN const SURVEY_ID = 'srv_abc123' async function fetchSurveyResponses() { const response = await fetch( `https://app.opineeo.com/api/survey/v0/results?surveyId=${SURVEY_ID}`, { headers: { 'Authorization': `Bearer ${API_TOKEN}` } } ) if (!response.ok) { throw new Error('Failed to fetch responses') } const data = await response.json() return data } // Usage in component export default function SurveyDashboard() { const [responses, setResponses] = useState([]) useEffect(() => { fetchSurveyResponses() .then(data => setResponses(data.responses)) .catch(error => console.error(error)) }, []) return ( <div> {responses.map(response => ( <div key={response.id}> {/* Display response */} </div> ))} </div> ) }
Common Error Codes
UNAUTHORIZED
(401): Invalid or missing API tokenFORBIDDEN
(403): Insufficient permissionsNOT_FOUND
(404): Resource not foundRATE_LIMITED
(429): Too many requestsINTERNAL_ERROR
(500): Server error
Support
Need help with the API? Contact our support team:
- Email: contact@opineeo.com
- Documentation: https://opineeo.com/docs