Survey API Documentation

Integration guide for Lovable CRM and other applications

Authentication
All API requests require an API key in the Authorization header

API Key Format

Authorization: Bearer sk_your_api_key_here

Example Request

curl -X GET https://survey.recast.software/api/trpc/auth.me \
  -H "Authorization: Bearer sk_your_api_key_here"
Endpoints
Available tRPC endpoints for survey management

Generate Invitation Token

Create a new invitation token for a community or customer user

POST/api/trpc/invitationCode.generateTestTokens
{
  "surveyType": "community" | "customer",
  "count": 1
}

Returns: Array of generated tokens with direct survey links

Submit Survey Response

Submit a completed survey response programmatically

POST/api/trpc/survey.submit
{
  "token": "survey_token_from_invitation",
  "contactName": "John Doe",
  "contactEmail": "[email protected]",
  "company": "Acme Corp",
  "answers": {
    "question_1": "answer_value",
    "question_2": ["option_1", "option_2"]
  }
}

List Survey Responses

Retrieve all survey responses with optional filtering

GET/api/trpc/survey.list
Query Parameters:
- limit: number (default: 50)
- offset: number (default: 0)
- surveyType: "community" | "customer" (optional)
- status: "pending" | "submitted" (optional)

Get Response Detail

Retrieve full details for a specific survey response

GET/api/trpc/survey.getDetail
{
  "responseId": 123
}

Create Customer

Create a new customer record in the system

POST/api/trpc/customers.create
{
  "customerId": "cust_123",
  "companyName": "Acme Corp",
  "contactName": "John Doe",
  "contactEmail": "[email protected]",
  "currentEndpoints": 100,
  "deployedModules": ["Patching", "Insights"]
}
Error Handling
Common error responses and how to handle them

401 Unauthorized

Invalid or missing API key. Verify your API key is correct and included in the Authorization header.

429 Too Many Requests

Rate limit exceeded. Your API key has a default limit of 1000 requests per hour.

400 Bad Request

Invalid request parameters. Check the request body matches the expected schema.

Getting Started
Steps to integrate the Survey API with Lovable CRM
  1. Generate an API key — Log in to the admin dashboard and create a new API key
  2. Store the key securely — Save it in your CRM's environment variables or secrets manager
  3. Test authentication — Make a test request to verify your API key works
  4. Integrate endpoints — Use the endpoints above to create tokens, submit responses, and retrieve data
  5. Monitor usage — Check your API audit log for request history and rate limit status
Support
Need help with the API?

Contact the RidgePoint team at [email protected] for technical support and integration assistance.