Upload IDs

POST https://amplitude.com/api/3/cohorts/upload

Generate a new cohort or update an existing cohort by uploading a set of User IDs or Amplitude IDs.

Body Parameters

ParameterDescription
nameRequired. String. A name for the cohort.
app_idRequired. Integer. An identifier for the Amplitude project containing the cohort.
id_typeRequired. String. The type of ID being sent in the ids field. Valid options are BY_AMP_ID or BY_USER_ID.
idsRequired. String[]. One or more user or Amplitude IDs to include in the cohort. The type of the IDs should be specified in the id_type field.
ownerRequired. String. The login email of the cohort's owner in Amplitude.
publishedRequired. Boolean. Whether the cohort is discoverable or hidden.
existing_cohort_idOptional. String. The id of an existing cohort. This will replace the contents for the specified cohort with the ids being uploaded by this request. e.g. '1a2bc3d' is your cohort's id, and it can be found in your cohort's URL. https//analytics.amplitude.com/demo/cohort/1a2bc3d

Request Body

{"name"=>"Test Cohort", "app_id"=>153957, "id_type"=>"BY_AMP_ID", "ids"=>["us-east-1:ffffe36b-5758-4869-8552-c764690b2b59", "us-east-1:ffffe322-9d03-4016-a5bd-7a9681fdf491"], "owner"=>"datamonster@amplitude.com", "published"=>true}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring

RESPONSES

status: OK

{"cohortId":"7y6y3ij","cohortsById":{"7y6y3ij":{"appId":360829,"archived":false,"definition":{"version":3,"countGroup":"User","cohortType":"UNIQUES","andClauses":[],"referenceFrameTimeParams":{}},"description":null,"finished":true,"id":"7y6y3ij","name":"Test Cohort","owners":["datamonster@amplitude.com"],"published":true,"size":2,"type":"manual_upload","lastMod":1644007218,"createdAt":1644007218,"lastComputed":1644007218,"hidden":false,"metadata":null,"view_count":null,"popularity":null,"last_viewed":null,"chart_id":null,"edit_id":null,"is_predictive":false,"is_official_content":false,"location_id":null,"shortcut_ids":[]}},"metadata":{"matched":2,"totals":2}}