- 23 Dec 2023
- 1 Minute to read
Upload Custom Segments to Mobile Suite
- Updated on 23 Dec 2023
- 1 Minute to read
Overview
This service enables you to upload custom segments via a CSV file to your Insider Mobile Suite. Once the uploading process is completed, the segment is automatically created on your mobile dashboard and you can see the results of the segment creation on the callback.
Endpoint and Headers
POST https://mobile.useinsider.com/api/custom_segment/v1/upload
Headers
Header | Sample Value | Description |
---|---|---|
Content-Type | application/json | This header specifies the media type of the source. |
Body Parameters
Header | Description | Data Type |
---|---|---|
api_key | Your API Key. Refer to API Authentication Tokens to get your API key. | String |
segment_name | Name of the custom segment. It must be a unique name. | String |
csv_url | URL where CSV is hosted. This URL should be downloadable. | String |
callback_url | Callback URL to receive the result of segment creation | String |
attribute | Name of the user attribute on which the segment is being created | String |
Sample Example
Sample Body
{
"api_key": "1a2b3c4d5e6f",
"segment_name": "My unique segment",
"csv_url": "https://s3.amazonaws.com/sample_csv_file.csv",
"callback_url": "https://localhost/12345",
"attribute": "email"
}
Sample API Responses
202 Accepted
The API request is a success. The results will be shown on the callback soon.
400 Bad Request
{
"error": "Segment Name Exists."
}
401 Unauthorized
{
"error": "Bad Api Key."
}
405 Invalid Payload
{
"error": "Invalid Payload."
}
500 Internal Server Error
There is an issue with your request format. The response message will indicate what the specific error is such as if our system couldn’t find the user, or a parameter is missing.
Sample Callback Responses
200 OK
{
"status": 200,
"segment_name": "My unique segment",
"matched_user_count": 5,
"sent_user_count": 12
}
500 Internal Server Error
There is an issue with your request format. The response message will indicate what the specific error is such as if our system couldn’t find the user, or a parameter is missing.
Error Messages
Error | Description |
---|---|
Invalid CSV URL | The CSV URL is invalid. The URL should include .csv extension. |
Segment Name Exists | The segment name in the request already exists on your panel. You should name your segment with a different name. |
Couldn't Read CSV File | Insider cannot access and download the CSV file. Be sure that the file is publicly accessible and downloadable. |