Skip to content

Surveys

Endpoints for querying available surveys.

List Surveys

GET /api/searches

Returns the list of surveys linked to the user's token.

Use cases:

  • Get survey IDs for integration
  • Populate survey selectors
  • Validate available surveys for dispatch

Request Example

bash
curl -X GET "https://api-b2s.experienciab2s.com/api/searches" \
     -H "Authorization: Bearer YOUR_TOKEN"

Success Response (200)

json
[
  {
    "id": "103a525c-0ce3-4182-a504-aad595425233",
    "name": "Satisfaction Survey - Restaurant",
    "company_id": "603a525c-0ce3-4182-a504-aad595425233"
  },
  {
    "id": "203a525c-0ce3-4182-a504-aad595425233",
    "name": "Satisfaction Survey - Delivery",
    "company_id": "503a525c-0ce3-4182-a504-aad595425233"
  }
]

Response Structure

FieldTypeDescription
idstringUnique survey ID (UUID)
namestringSurvey name
company_idstringLinked company ID (UUID)

Response Codes

CodeDescription
200Surveys found
401Missing or invalid token
403Invalid token or unauthorized user
404Integration token not found

Get Survey with Questions

GET /api/searches/:id

Returns the complete details of a survey, including all questions with multi-language support. The response structure varies based on the has_page value:

  • has_page: false: Questions are returned directly in the questions field
  • has_page: true: Questions are organized within pages in the pages field

Use cases:

  • Render custom survey form
  • Get complete question structure for integration
  • Load question translations for multilingual systems
  • Validate question types and formats before submission

URL Parameters

ParameterTypeRequiredDescription
idstringYesUnique survey ID (UUID)

Request Example

bash
curl -X GET "https://api-b2s.experienciab2s.com/api/searches/103a525c-0ce3-4182-a504-aad595425233" \
     -H "Authorization: Bearer YOUR_TOKEN"

Success Response (200) - Without Pages

When has_page is false, questions are returned directly:

json
{
  "has_page": false,
  "translations": [
    {
      "language_code": "pt-BR",
      "nps": "Como você avalia sua experiência?",
      "discursive_question": "Deixe seu comentário",
      "question_page": "Em qual salão você se encontra?"
    },
    {
      "language_code": "en-US",
      "nps": "How do you rate your experience?",
      "discursive_question": "Leave your comment",
      "question_page": "Which salon are you at?"
    }
  ],
  "questions": [
    {
      "id": "q1-uuid-example",
      "required": true,
      "others": false,
      "unknown": false,
      "type": "Resposta curta",
      "format": "default",
      "options": [],
      "translations": [
        {
          "language_code": "pt-BR",
          "name": "Qual seu nome completo?",
          "description": "Informe seu nome para identificação"
        },
        {
          "language_code": "en-US",
          "name": "What is your full name?",
          "description": "Enter your name for identification"
        }
      ]
    },
    {
      "id": "q2-uuid-example",
      "required": false,
      "others": false,
      "unknown": false,
      "type": "Rating",
      "format": "default",
      "options": [
        {
          "id": "opt1-uuid",
          "translations": [
            {
              "language_code": "pt-BR",
              "name": "Excelente"
            },
            {
              "language_code": "en-US",
              "name": "Excellent"
            }
          ]
        },
        {
          "id": "opt2-uuid",
          "translations": [
            {
              "language_code": "pt-BR",
              "name": "Bom"
            },
            {
              "language_code": "en-US",
              "name": "Good"
            }
          ]
        }
      ],
      "translations": [
        {
          "language_code": "pt-BR",
          "name": "Como você avalia o atendimento?",
          "description": "Avalie a qualidade do atendimento recebido",
          "detractor_replica": "Lamentamos pela sua experiência",
          "neutral_replica": "Obrigado pelo feedback",
          "promoter_replica": "Ficamos felizes com sua avaliação!"
        },
        {
          "language_code": "en-US",
          "name": "How do you rate the service?",
          "description": "Rate the quality of the service received",
          "detractor_replica": "We're sorry for your experience",
          "neutral_replica": "Thank you for your feedback",
          "promoter_replica": "We're happy with your rating!"
        }
      ]
    }
  ]
}

Success Response (200) - With Pages

When has_page is true, questions are organized in pages:

json
{
  "has_page": true,
  "translations": [
    {
      "language_code": "pt-BR",
      "nps": "Como você avalia sua experiência?",
      "discursive_question": "Deixe seu comentário",
      "question_page": "Em qual salão você se encontra?"
    },
    {
      "language_code": "en-US",
      "nps": "How do you rate your experience?",
      "discursive_question": "Leave your comment",
      "question_page": "Which salon are you at?"
    }
  ],
  "pages": [
    {
      "id": "page1-uuid-example",
      "translations": [
        {
          "language_code": "pt-BR",
          "name": "Dados Pessoais"
        },
        {
          "language_code": "en-US",
          "name": "Personal Data"
        }
      ],
      "questions": [
        {
          "id": "q1-uuid-example",
          "required": true,
          "others": false,
          "unknown": false,
          "type": "Resposta curta",
          "format": "default",
          "options": [],
          "translations": [
            {
              "language_code": "pt-BR",
              "name": "Qual seu nome completo?",
              "description": "Informe seu nome para identificação"
            },
            {
              "language_code": "en-US",
              "name": "What is your full name?",
              "description": "Enter your name for identification"
            }
          ]
        }
      ]
    },
    {
      "id": "page2-uuid-example",
      "translations": [
        {
          "language_code": "pt-BR",
          "name": "Avaliação do Atendimento"
        },
        {
          "language_code": "en-US",
          "name": "Service Evaluation"
        }
      ],
      "questions": [
        {
          "id": "q2-uuid-example",
          "required": true,
          "others": false,
          "unknown": false,
          "type": "Rating",
          "format": "default",
          "options": [
            {
              "id": "opt1-uuid",
              "translations": [
                {
                  "language_code": "pt-BR",
                  "name": "Excelente"
                },
                {
                  "language_code": "en-US",
                  "name": "Excellent"
                }
              ]
            },
            {
              "id": "opt2-uuid",
              "translations": [
                {
                  "language_code": "pt-BR",
                  "name": "Bom"
                },
                {
                  "language_code": "en-US",
                  "name": "Good"
                }
              ]
            }
          ],
          "translations": [
            {
              "language_code": "pt-BR",
              "name": "Como você avalia o atendimento?",
              "description": "Avalie a qualidade do atendimento recebido",
              "detractor_replica": "Lamentamos pela sua experiência",
              "neutral_replica": "Obrigado pelo feedback",
              "promoter_replica": "Ficamos felizes com sua avaliação!"
            },
            {
              "language_code": "en-US",
              "name": "How do you rate the service?",
              "description": "Rate the quality of the service received",
              "detractor_replica": "We're sorry for your experience",
              "neutral_replica": "Thank you for your feedback",
              "promoter_replica": "We're happy with your rating!"
            }
          ]
        }
      ]
    }
  ]
}

Response Structure

FieldTypeDescription
has_pagebooleanIndicates if the survey has multiple pages
translationsarrayTranslations of the survey's main texts
questionsarrayList of questions (only when has_page: false)
pagesarrayList of pages with questions (only when has_page: true)

translations object (survey)

FieldTypeDescription
language_codestringLanguage code (e.g., "pt-BR", "en-US", "es-ES")
npsstringMain NPS question text
discursive_questionstringDiscursive/comment question text
question_pagestringPage selection question text

Page Structure

FieldTypeDescription
idstringUnique page ID (UUID)
translationsarrayPage name translations
questionsarrayList of page questions

translations object (page)

FieldTypeDescription
language_codestringLanguage code (e.g., "pt-BR", "en-US")
namestringPage name/title

Question Structure

FieldTypeDescription
idstringUnique question ID (UUID)
requiredbooleanWhether the question is required
othersbooleanWhether "Others" option is allowed
unknownbooleanWhether "Don't know/Unknown" option is allowed
typestringQuestion type (see table below)
formatstringDisplay format (see table below)
optionsarrayAvailable response options
translationsarrayQuestion translations in different languages

Question Types (type)

TypeDescription
AtendenteAttendant/employee selection
Caixa de seleçãoMultiple choice with checkboxes
CSATCustomer Satisfaction Score (1-5)
DataDate selection field
EmoticonEmoticon/emoji rating
Like/DislikeBinary rating (like/dislike)
Multipla escolhaSelection among multiple options
NPSNet Promoter Score (0-10)
RatingStar/score rating
Resposta curtaFree text field

Display Formats (format)

FormatDescriptionAvailable in
defaultDefault display (buttons/cards)All types
selectDropdown menuAtendente, Multipla escolha
checkboxMultiple selection checkboxAtendente

translations object (question)

FieldTypeDescription
language_codestringLanguage code (e.g., "pt-BR", "en-US")
namestringTranslated question text
descriptionstringTranslated description (optional)
promoter_replicastringResponse for high scores (optional)
neutral_replicastringResponse for medium scores (optional)
detractor_replicastringResponse for low scores (optional)
criteriastringTranslated criteria (optional)

Option Structure

FieldTypeDescription
idstringUnique option ID (UUID)
translationsarrayOption translations in other languages

translations object (option)

FieldTypeDescription
language_codestringLanguage code (e.g., "pt-BR", "en-US")
namestringTranslated option text

Response Codes

CodeDescription
200Survey found successfully
401Missing or invalid token
403Invalid token or unauthorized user
404Survey not found
  1. Fetch survey: GET /api/searches/:id
  2. Select language: Filter translations by the desired language_code
  3. Check has_page:
    • If false: Iterate directly over questions
    • If true: Show page selection and iterate over pages[].questions
  4. Render questions: Use translations to display in the correct language

Integration Documentation