> For the complete documentation index, see [llms.txt](https://documentation.blitzllama.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.blitzllama.com/sdk/api.md).

# API

To push your survey responses from other tools like Intercom and Verloop to Blitzllama, you'll need to follow these steps to get survey configurations and push user response data.

### **Authentication** <a href="#authentication" id="authentication"></a>

**You'll need specific credentials to authenticate your requests:**

1. Log in to your Blitzllama dashboard.&#x20;
2. Navigate to the Connections tab to find the necessary credentials.

**Setting Up the Integration**

1. In your Blitzllama account, go to the Connections tab.&#x20;
2. Select Export API and then click on Enable.&#x20;
3. Copy the Blitzllama API Key. This key will be used as the Authorization header \[x-api-key] in your API requests.

**API Request Details**

1. Base URL: <https://api.blitzllama.com/api/v1&#x20>;

Use this URL to send API requests, ensuring to include the copied API Key in the header for authentication.

### **Create New Survey**

1. Go to Research tab and create a new survey or use an existing survey template.
2. The question type and question order should match with the survey in the other tool. \
   [Example: If you ask "Please rate your conversation" (rating of 1 to 5) and "What could we improve?" (open text question) after closing the Intercom conversation, you need to have the same questions on Blitzllama's survey too.](#user-content-fn-1)[^1]
3. Navigate to the Configuration tab and choose API as the platform.
4. Launch the survey.

### **Survey Config API**

```typescript
//You can fetch the above created survey via this API. 
GET "/survey/:survey_id/config"

{
    "data": {
        "survey": {
            "survey_name": "Testing Template",
            "created_at": "2024-04-24T17:41:43.466Z",
            "survey_id": "s-id value"
        },
        "questions": [
            {
                "properties": {
                    "labels": {
                        "left": "left label value",
                        "right": "right label value"
                    },
                    "randomize": "in_set",
                    "options": []
                },
                "question_text": "Your first question!",
                "question_desc": "Tip1: You can change the colors of this widget from the Setting tab.",
                "question_order": 1,
                "question_type": "scale_feedback"
            },
           ...
        ]
    }
}

```

#### **Question Type Values**

```typescript
  Select Based Questions
  'multi_select_feedback'
  'single_select_feedback'
  
  Range-Based Question [0-10]
  'nps_feedback'   
  
  Range-Based Question [1-5]
  'scale_feedback'
  'star_feedback'
  'emoji_feedback'
  
  Text-Based Question
  'input_feedback'
  'data_collection'
  
  Click-Based Question
 'intro_prompt'
```

### **User Response**

```json
POST "/survey/:survey_id/response"


{
    "user_id": "user_id", //string
    "group_id": "g-id", // id to indentify a individual user response collection.
    "question_order": 1, //int value
    "user_response": "Great" // user response with data type number/string/array
}

```

```
User Response Datatype
number - Range [1 - 5] rating scale, star, emoji responses
Eg. "user_response": 1

number - Range [0 - 10] NPS responses
Eg. "user_response": 10

text-- text-based questions
Eg. "user_response": "Great"

array -- select based questions
Eg. "user_response": ["Option A", "Option B"]
```

{% hint style="warning" %}

```
group_id has to be unique for each survey user response collection. 
Don't duplicate any user response.This has to be generated from the client side 
(preferably uuid string).

```

{% endhint %}

[^1]:
