> ## Documentation Index
> Fetch the complete documentation index at: https://docs-saas.primeearn.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Server-to-server API for showing surveys to your users and qualifying them, on your own partners domain.

The Surveys API lets your platform fetch surveys for each of your users, run them through qualification, and send them into a survey.

## Base URL

Every request goes to your own partners host:

```text theme={null}
https://partners.{your-domain}
```

Replace `{your-domain}` with your platform's domain. For example, if your platform runs on `example.com`, call `https://partners.example.com/api/surveys`. In these docs, "partners host" means this URL.

## What you need

| Value | What it is | Where you get it |
| - | - | - |
| `app` | Your app hash | Your account manager |
| `token` | Your app API token | Your account manager. Required when secure API mode is on for your app. |
| `external_user_id` | Your own ID for the user | Your system |
| Server IPs | The IPs your servers call from | Send them to your account manager if your app uses an IP allowlist |

## Integration flow

**1. Get surveys for a user**

Call [Get surveys](https://docs-saas.primeearn.com/surveys/get-surveys.md) from your server with `app`, `external_user_id` and the user's IP. The user is created on the first call. The response contains `uh`, the user hash, and a list of surveys.

**2. Choose a path**

Either send the user straight to the survey's `url`, where qualification happens on the survey page, or run qualification inside your own UI with the steps below.

**3. Start qualification**

Call [Start qualification](https://docs-saas.primeearn.com/surveys/qualification/start.md) with the survey `hash`, authenticated with `Bearer {uh}`.

**4. Answer questions**

While `status` is `accepted`, show `questions.current` and send the answer to [Submit an answer](https://docs-saas.primeearn.com/surveys/qualification/submit-answer.md). Use [Search answers](https://docs-saas.primeearn.com/surveys/qualification/search-answers.md) for `autocomplete` questions.

**5. Send the user to the survey**

When `status` is `qualified`, redirect the user to `url`. When it is `disqualified`, show your own "no match" screen and offer other surveys.

## Response conventions

* Responses are JSON.
* Many business outcomes come back with HTTP `200` and are described in the body (`status` and `message`). Always check the body, not only the HTTP code.
* See [Authentication](https://docs-saas.primeearn.com/surveys/authentication.md) for auth, IP allowlisting, rate limits and the errors they return.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.