Integrations: FeedLetter API

Available with Business plans.

Create Survey

Creates a new public survey for the authenticated account.

Authentication is done via the Authorization header, using the API key as the header value.

Endpoint

POST https://api.feedletter.co/api/public/surveys

Headers

Authorization: <api-key>
Content-Type: application/json

Request body

{
  "survey_type": "newsletter",
  "name": "April Product Feedback"
}

For onetime and webrating, include template_id:

{
  "survey_type": "onetime",
  "name": "Homepage Poll April",
  "template_id": "550e8400-e29b-41d4-a716-446655440000"
}

Fields

FieldTypeRequiredDescription
survey_typestringyesOne of newsletter, onetime, or webrating
namestringyesName of the survey
template_idUUID stringonly for onetime and webratingTemplate survey ID to clone from

Rules

  • survey_type must be one of:

    • newsletter
    • onetime
    • webrating
  • template_id is required for onetime and webrating

  • template_id must belong to the authenticated account

  • survey names must be unique per account

Example requests

Newsletter

curl -X POST https://your-api-host/api/public/surveys \
  -H "Authorization: <api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "survey_type": "newsletter",
    "name": "April Newsletter Feedback"
  }'

One-time

curl -X POST https://your-api-host/api/public/surveys \
  -H "Authorization: <api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "survey_type": "onetime",
    "name": "Homepage Poll April",
    "template_id": "550e8400-e29b-41d4-a716-446655440000"
  }'

Web rating

curl -X POST https://your-api-host/api/public/surveys \
  -H "Authorization: <api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "survey_type": "webrating",
    "name": "Pricing Page Rating",
    "template_id": "550e8400-e29b-41d4-a716-446655440000"
  }'

Success response

For newsletter and onetime surveys:

{
  "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "email_section": "<p><strong>How was this issue?</strong></p><p>Pick the option that fits best.</p><ul><li><a href=\"https://a.feedletter.co/s/f47ac10b-58cc-4372-a567-0e02b2c3d479/1\" target=\"_blank\">Great</a></li><li><a href=\"https://a.feedletter.co/s/f47ac10b-58cc-4372-a567-0e02b2c3d479/2\" target=\"_blank\">Okay</a></li><li><a href=\"https://a.feedletter.co/s/f47ac10b-58cc-4372-a567-0e02b2c3d479/3\" target=\"_blank\">Not good</a></li></ul>",
  "links": [
    {
      "href": "https://a.feedletter.co/s/f47ac10b-58cc-4372-a567-0e02b2c3d479/1",
      "text": "Great"
    },
    {
      "href": "https://a.feedletter.co/s/f47ac10b-58cc-4372-a567-0e02b2c3d479/2",
      "text": "Okay"
    },
    {
      "href": "https://a.feedletter.co/s/f47ac10b-58cc-4372-a567-0e02b2c3d479/3",
      "text": "Not good"
    }
  ]
}

For webrating surveys:

{
  "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}

Response fields

FieldTypeDescription
idUUID stringNewly created survey ID
email_sectionstringHTML snippet for embedding the survey into an email
linksarrayList of survey option links
FieldTypeDescription
hrefstringPublic response URL for an option
textstringLabel shown for that option

Error response format

{
  "message": "TemplateId is required"
}

Common errors

422 Unprocessable Entity

{
  "message": "Invalid survey type (know: newsletter, onetime & webrating)"
}
{
  "message": "TemplateId is required"
}
{
  "message": "Survey with this name already exists"
}

400 Bad Request

{
  "message": "Can't find survey with provided template id"
}
{
  "message": "Access Denied for provided template id"
}