---
title: "Create a User Segment"
method: POST
path: "/qganalyzedata/upload_segment/"
---

# Create a User Segment

`POST /qganalyzedata/upload_segment/`

## Request

- Base URL: `https://aiqua.appier.com`
- URL: `https://aiqua.appier.com/qganalyzedata/upload_segment/`
- Auth: API key in header `appId` and API key in header `Authorization`

Create a segment from a file uploaded in the first step ([Upload a Segment File](ref:upload-segment-file)).

### Unified segments

If your account has migrated to the <a href="https://docs.enterprise.appier.com/docs/segments-getting-started" target="_blank">new segment experience</a>, this endpoint creates a unified segment. Otherwise, this endpoint creates a legacy segment.

### Authorization

Send two headers with every request:

- `appId`: Your AIQUA app ID.
- `Authorization`: Your AIQUA API token, prefixed with the word "Token", for example, `Token abc123`.

## Request body

- object
  - `name` string, required: The name to assign to the segment.
  - `description` string: A description for the segment.
  - `filename` string, required: The temporary filename returned in the response from uploading the segment file.
  - `field` string, required: The field name whose values are present in the uploaded file. For example, `email`, `phoneNo`, or `user_id`.

## Response `200`

Success

- object
  - `segmentId` string: The ID of the newly created segment.

---

[API](https://skmtc.dev/appier/apis/create-a-segment-by-mapping-with-user-list.md) - [All operations](https://skmtc.dev/appier/apis/create-a-segment-by-mapping-with-user-list/llms.txt) - [OpenAPI document](https://skmtc.dev/appier/apis/create-a-segment-by-mapping-with-user-list/revisions/d3c24befc0ab?raw)
