The Amplitude Developers Postman profile has a full library of example requests and responses for this API.
Check out the Amplitude Developers Profile to view the collection. You don't need a Postman account to browse.
If you already use Postman, you can .
Authorization
This API doesn't use authorization, but uses your API key. Pass your API key in the body of the request like
POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
4.See Find your Amplitude Project API Credentials for help locating your credentials.
Endpoints
RegionEndpointStandard Server//api2.amplitude.com/2/httpapiEU Residency Server//api.eu.amplitude.com/2/httpapiConsiderations
Upload limit
For Starter plan customers:
Limit your upload to 100 batches per second and 1000 events per second. You can batch events into an upload, but don't send more than 10 events per batch. Amplitude expects fewer than 100 batches per second, and the 1000 events per second limit still applies.
For customers on Growth and Enterprise plans:
Contact Support if you need to send more than 1000 events per second. There is no hard limit on the Enterprise plan, but devices that exceed 30 events per second are throttled.
Keep request sizes under 1 MB with fewer than 2000 events per request. When you exceed these size limits, you get a 413 error.
If you have high volume and concerned with scale, partition your work based on
POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
5 or POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
6. This ensures that throttling on a particular POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
5 [or POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
6] doesn't impact all senders in your system. If you are using a proxy service to send events to Amplitude, make sure that throttling is forwarded to your clients, instead of letting spammy clients slow down a partition of work in your system.Information for partner integrations
If you have an event ingestion integration with Amplitude, you need to send your integration's assigned partner ID in the event payload.
For help finding your integration's partner ID and a payload example, see .
All-zero device IDs: Limit Ad Tracking enabled
As of iOS 10, Apple replaces the Identifier for Advertiser [IDFA] with all zeros if the user enables Limit Ad Tracking. Because all events require a device ID, Amplitude drops device IDs of all zeros and returns an error on the request.
If you are passing the IDFA as the device ID, first run a check on the IDFA value. If it's all zeros, pass a different value for the device ID, such as the Identifier for Vendor [IDFV].
Windows OS
If you are using a Windows operating system, then you may have to replace all single quotes with escaped double quotes.
String character limit
All string values, like
POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
6, event, or user property values, have a character limit of 1024 characters.Set date values
Amplitude compares dates as strings, so it's best to use the ISO 8601 format [
var headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
$.ajax[{
url: '//api2.amplitude.com/2/httpapi',
method: 'post',
headers: headers,
success: function[data] {
console.log[JSON.stringify[data]];
}
}]
0]. This format lets you perform date comparisons, [for example: var headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
$.ajax[{
url: '//api2.amplitude.com/2/httpapi',
method: 'post',
headers: headers,
success: function[data] {
console.log[JSON.stringify[data]];
}
}]
1]. Comparison also works for datetime values in this format [for example: var headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
$.ajax[{
url: '//api2.amplitude.com/2/httpapi',
method: 'post',
headers: headers,
success: function[data] {
console.log[JSON.stringify[data]];
}
}]
2].Set time values
You must send the
var headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
$.ajax[{
url: '//api2.amplitude.com/2/httpapi',
method: 'post',
headers: headers,
success: function[data] {
console.log[JSON.stringify[data]];
}
}]
3 parameter in each event as millisecond since epoch. Any other format [such as ISO format] results in a 400 Bad Request response.Event deduplication
It's highly recommended that you send an
var headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
$.ajax[{
url: '//api2.amplitude.com/2/httpapi',
method: 'post',
headers: headers,
success: function[data] {
console.log[JSON.stringify[data]];
}
}]
4 for each event to prevent sending duplicate events to Amplitude. Amplitude ignores subsequent events sent with the same var headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
$.ajax[{
url: '//api2.amplitude.com/2/httpapi',
method: 'post',
headers: headers,
success: function[data] {
console.log[JSON.stringify[data]];
}
}]
4 on the same POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
5 [if the event has a POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
5 value] in each app within the past 7 days.Device IDs and User IDs minimum length
Device IDs and User IDs must be strings with a length of 5 characters or more. This is to prevent potential instrumentation issues. If an event contains a device ID or user ID that's too short, the ID value is removed from the event.
Override the default minimum length of 5 character by passing the
var headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
$.ajax[{
url: '//api2.amplitude.com/2/httpapi',
method: 'post',
headers: headers,
success: function[data] {
console.log[JSON.stringify[data]];
}
}]
8 option with the request.If the event doesn't have a
POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
6 or POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
5 value, the upload may be rejected with a 400 status.Invalid IDsThese IDs are invalid, and result in a 400 error:
- "anonymous"
- "nil"
- "none"
- "null"
- "n/a"
- "na"
- "undefined"
- "unknown"
- """"
- "00000000-0000-0000-0000-000000000000"
- "{}"
- "lmy47d"
- "0"
- "-1"
Upload request
Send a POST request to
const request = require['node-fetch'];
const inputBody = '{
"api_key": "my_amplitude_api_key",
"events": [
{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial",
"time": 1396381378123,
"event_properties": {
"load_time": 0.8371,
"source": "notification",
"dates": [
"monday",
"tuesday"
]
},
"user_properties": {
"age": 25,
"gender": "female",
"interests": [
"chess",
"football",
"music"
]
},
"groups": {
"company_id": "123",
"department_id": [
"abc",
"xyz"
]
},
"app_version": "2.1.3",
"platform": "iOS",
"os_name": "Android",
"os_version": "4.2.2",
"device_brand": "Verizon",
"device_manufacturer": "Apple",
"device_model": "iPhone 9,1",
"carrier": "Verizon",
"country": "United States",
"region": "California",
"city": "San Francisco",
"dma": "San Francisco-Oakland-San Jose, CA",
"language": "English",
"price": 4.99,
"quantity": 3,
"revenue": -1.99,
"productId": "Google Pay Store Product Id",
"revenueType": "Refund",
"location_lat": 37.77,
"location_lng": -122.39,
"ip": "127.0.0.1",
"idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"idfv": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"adid": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"android_id": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"event_id": 23,
"session_id": 1396381378123,
"insert_id": "5f0adeff-6668-4427-8d02-57d803a2b841"
}
]
}';
const headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
fetch['//api2.amplitude.com/2/httpapi',
{
method: 'POST',
body: inputBody,
headers: headers
}]
.then[function[res] {
return res.json[];
}].then[function[body] {
console.log[body];
}];
1Example request
cURLHTTPJavaScriptNodeJsRubyPythonJavaGo
# You can also use wget
curl -X POST //api2.amplitude.com/2/httpapi \
-H 'Content-Type: application/json' \
-H 'Accept: */*'
POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
var headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
$.ajax[{
url: '//api2.amplitude.com/2/httpapi',
method: 'post',
headers: headers,
success: function[data] {
console.log[JSON.stringify[data]];
}
}]
const request = require['node-fetch'];
const inputBody = '{
"api_key": "my_amplitude_api_key",
"events": [
{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial",
"time": 1396381378123,
"event_properties": {
"load_time": 0.8371,
"source": "notification",
"dates": [
"monday",
"tuesday"
]
},
"user_properties": {
"age": 25,
"gender": "female",
"interests": [
"chess",
"football",
"music"
]
},
"groups": {
"company_id": "123",
"department_id": [
"abc",
"xyz"
]
},
"app_version": "2.1.3",
"platform": "iOS",
"os_name": "Android",
"os_version": "4.2.2",
"device_brand": "Verizon",
"device_manufacturer": "Apple",
"device_model": "iPhone 9,1",
"carrier": "Verizon",
"country": "United States",
"region": "California",
"city": "San Francisco",
"dma": "San Francisco-Oakland-San Jose, CA",
"language": "English",
"price": 4.99,
"quantity": 3,
"revenue": -1.99,
"productId": "Google Pay Store Product Id",
"revenueType": "Refund",
"location_lat": 37.77,
"location_lng": -122.39,
"ip": "127.0.0.1",
"idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"idfv": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"adid": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"android_id": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"event_id": 23,
"session_id": 1396381378123,
"insert_id": "5f0adeff-6668-4427-8d02-57d803a2b841"
}
]
}';
const headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
fetch['//api2.amplitude.com/2/httpapi',
{
method: 'POST',
body: inputBody,
headers: headers
}]
.then[function[res] {
return res.json[];
}].then[function[body] {
console.log[body];
}];
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => '*/*'
}
result = RestClient.post '//api2.amplitude.com/2/httpapi',
params: {
}, headers: headers
p JSON.parse[result]
import requests
headers = {
'Content-Type': 'application/json',
'Accept': '*/*'
}
r = requests.post['//api2.amplitude.com/2/httpapi', params={
}, headers = headers]
print r.json[]
URL obj = new URL["//api2.amplitude.com/2/httpapi"];
HttpURLConnection con = [HttpURLConnection] obj.openConnection[];
con.setRequestMethod["POST"];
int responseCode = con.getResponseCode[];
BufferedReader in = new BufferedReader[
new InputStreamReader[con.getInputStream[]]];
String inputLine;
StringBuffer response = new StringBuffer[];
while [[inputLine = in.readLine[]] != null] {
response.append[inputLine];
}
in.close[];
System.out.println[response.toString[]];
package main
import [
"bytes"
"net/http"
]
func main[] {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"*/*"},
}
data := bytes.NewBuffer[[]byte{jsonReq}]
req, err := http.NewRequest["POST", "//api2.amplitude.com/2/httpapi", data]
req.Header = headers
client := &http.Client{}
resp, err := client.Do[req]
// ...
}
Upload request body parameters
NameDescriptionconst request = require['node-fetch'];
const inputBody = '{
"api_key": "my_amplitude_api_key",
"events": [
{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial",
"time": 1396381378123,
"event_properties": {
"load_time": 0.8371,
"source": "notification",
"dates": [
"monday",
"tuesday"
]
},
"user_properties": {
"age": 25,
"gender": "female",
"interests": [
"chess",
"football",
"music"
]
},
"groups": {
"company_id": "123",
"department_id": [
"abc",
"xyz"
]
},
"app_version": "2.1.3",
"platform": "iOS",
"os_name": "Android",
"os_version": "4.2.2",
"device_brand": "Verizon",
"device_manufacturer": "Apple",
"device_model": "iPhone 9,1",
"carrier": "Verizon",
"country": "United States",
"region": "California",
"city": "San Francisco",
"dma": "San Francisco-Oakland-San Jose, CA",
"language": "English",
"price": 4.99,
"quantity": 3,
"revenue": -1.99,
"productId": "Google Pay Store Product Id",
"revenueType": "Refund",
"location_lat": 37.77,
"location_lng": -122.39,
"ip": "127.0.0.1",
"idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"idfv": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"adid": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"android_id": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"event_id": 23,
"session_id": 1396381378123,
"insert_id": "5f0adeff-6668-4427-8d02-57d803a2b841"
}
]
}';
const headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
fetch['//api2.amplitude.com/2/httpapi',
{
method: 'POST',
body: inputBody,
headers: headers
}]
.then[function[res] {
return res.json[];
}].then[function[body] {
console.log[body];
}];
2Required. String. Amplitude project API key.Required. []. Array of to upload.Optional. []. Object.Example upload request body{
"api_key": "my_amplitude_api_key",
"events": [
{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial",
"time": 1396381378123,
"event_properties": {
"load_time": 0.8371,
"source": "notification",
"dates": [
"monday",
"tuesday"
]
},
"user_properties": {
"age": 25,
"gender": "female",
"interests": [
"chess",
"football",
"music"
]
},
"groups": {
"company_id": "123",
"department_id": [
"abc",
"xyz"
]
},
"app_version": "2.1.3",
"platform": "iOS",
"os_name": "Android",
"os_version": "4.2.2",
"device_brand": "Verizon",
"device_manufacturer": "Apple",
"device_model": "iPhone 9,1",
"carrier": "Verizon",
"country": "United States",
"region": "California",
"city": "San Francisco",
"dma": "San Francisco-Oakland-San Jose, CA",
"language": "English",
"price": 4.99,
"quantity": 3,
"revenue": -1.99,
"productId": "Google Pay Store Product Id",
"revenueType": "Refund",
"location_lat": 37.77,
"location_lng": -122.39,
"ip": "127.0.0.1",
"idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"idfv": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"adid": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"android_id": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"event_id": 23,
"session_id": 1396381378123,
"insert_id": "5f0adeff-6668-4427-8d02-57d803a2b841"
}
]
}
Keys for the event argument
You can send these keys in the JSON event object. Note that one of
POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
6 or POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
5 is required, as well as the const request = require['node-fetch'];
const inputBody = '{
"api_key": "my_amplitude_api_key",
"events": [
{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial",
"time": 1396381378123,
"event_properties": {
"load_time": 0.8371,
"source": "notification",
"dates": [
"monday",
"tuesday"
]
},
"user_properties": {
"age": 25,
"gender": "female",
"interests": [
"chess",
"football",
"music"
]
},
"groups": {
"company_id": "123",
"department_id": [
"abc",
"xyz"
]
},
"app_version": "2.1.3",
"platform": "iOS",
"os_name": "Android",
"os_version": "4.2.2",
"device_brand": "Verizon",
"device_manufacturer": "Apple",
"device_model": "iPhone 9,1",
"carrier": "Verizon",
"country": "United States",
"region": "California",
"city": "San Francisco",
"dma": "San Francisco-Oakland-San Jose, CA",
"language": "English",
"price": 4.99,
"quantity": 3,
"revenue": -1.99,
"productId": "Google Pay Store Product Id",
"revenueType": "Refund",
"location_lat": 37.77,
"location_lng": -122.39,
"ip": "127.0.0.1",
"idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"idfv": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"adid": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"android_id": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"event_id": 23,
"session_id": 1396381378123,
"insert_id": "5f0adeff-6668-4427-8d02-57d803a2b841"
}
]
}';
const headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
fetch['//api2.amplitude.com/2/httpapi',
{
method: 'POST',
body: inputBody,
headers: headers
}]
.then[function[res] {
return res.json[];
}].then[function[body] {
console.log[body];
}];
7.Name
DescriptionPOST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
6Required if POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
5 isn't used. String. ID for the user. Must have a minimum length of 5 characters unless overridden with the require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => '*/*'
}
result = RestClient.post '//api2.amplitude.com/2/httpapi',
params: {
}, headers: headers
p JSON.parse[result]
0 option.POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
5Required if POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
6 isn't used. String. A device-specific identifier, such as the Identifier for Vendor on iOS. If a POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
5 isn't sent with the event, then it's set to a hashed version of the POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
6.const request = require['node-fetch'];
const inputBody = '{
"api_key": "my_amplitude_api_key",
"events": [
{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial",
"time": 1396381378123,
"event_properties": {
"load_time": 0.8371,
"source": "notification",
"dates": [
"monday",
"tuesday"
]
},
"user_properties": {
"age": 25,
"gender": "female",
"interests": [
"chess",
"football",
"music"
]
},
"groups": {
"company_id": "123",
"department_id": [
"abc",
"xyz"
]
},
"app_version": "2.1.3",
"platform": "iOS",
"os_name": "Android",
"os_version": "4.2.2",
"device_brand": "Verizon",
"device_manufacturer": "Apple",
"device_model": "iPhone 9,1",
"carrier": "Verizon",
"country": "United States",
"region": "California",
"city": "San Francisco",
"dma": "San Francisco-Oakland-San Jose, CA",
"language": "English",
"price": 4.99,
"quantity": 3,
"revenue": -1.99,
"productId": "Google Pay Store Product Id",
"revenueType": "Refund",
"location_lat": 37.77,
"location_lng": -122.39,
"ip": "127.0.0.1",
"idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"idfv": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"adid": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"android_id": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"event_id": 23,
"session_id": 1396381378123,
"insert_id": "5f0adeff-6668-4427-8d02-57d803a2b841"
}
]
}';
const headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
fetch['//api2.amplitude.com/2/httpapi',
{
method: 'POST',
body: inputBody,
headers: headers
}]
.then[function[res] {
return res.json[];
}].then[function[body] {
console.log[body];
}];
7Required. String. A unique identifier for your event. The following event names are reserved for Amplitude use: require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => '*/*'
}
result = RestClient.post '//api2.amplitude.com/2/httpapi',
params: {
}, headers: headers
p JSON.parse[result]
6 Start Session", require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => '*/*'
}
result = RestClient.post '//api2.amplitude.com/2/httpapi',
params: {
}, headers: headers
p JSON.parse[result]
6 End Session", require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => '*/*'
}
result = RestClient.post '//api2.amplitude.com/2/httpapi',
params: {
}, headers: headers
p JSON.parse[result]
6 Revenue", require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => '*/*'
}
result = RestClient.post '//api2.amplitude.com/2/httpapi',
params: {
}, headers: headers
p JSON.parse[result]
6 Revenue [Verified]", require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => '*/*'
}
result = RestClient.post '//api2.amplitude.com/2/httpapi',
params: {
}, headers: headers
p JSON.parse[result]
6 Revenue [Unverified]", and require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => '*/*'
}
result = RestClient.post '//api2.amplitude.com/2/httpapi',
params: {
}, headers: headers
p JSON.parse[result]
6 Merged User".var headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
$.ajax[{
url: '//api2.amplitude.com/2/httpapi',
method: 'post',
headers: headers,
success: function[data] {
console.log[JSON.stringify[data]];
}
}]
3Optional. The timestamp of the event in milliseconds since epoch. If time isn't sent with the event, then it's set to the request upload time.import requests
headers = {
'Content-Type': 'application/json',
'Accept': '*/*'
}
r = requests.post['//api2.amplitude.com/2/httpapi', params={
}, headers = headers]
print r.json[]
3Optional. Object. A dictionary of key-value pairs that represent data to send along with the event. You can store property values in an array. Date values are transformed into string values. Object depth may not exceed 40 layers.import requests
headers = {
'Content-Type': 'application/json',
'Accept': '*/*'
}
r = requests.post['//api2.amplitude.com/2/httpapi', params={
}, headers = headers]
print r.json[]
4Optional. Object. A dictionary of key-value pairs that represent data tied to the user. You can store property values in an array. Date values are transformed into string values. Object depth may not exceed 40 layers.import requests
headers = {
'Content-Type': 'application/json',
'Accept': '*/*'
}
r = requests.post['//api2.amplitude.com/2/httpapi', params={
}, headers = headers]
print r.json[]
5Optional. Object. This feature is only available to Enterprise customers who have purchased the Accounts add-on. This field adds a dictionary of key-value pairs that represent groups of users to the event as an event-level group. You can track up to 5 unique group types and 10 total group values per event. Any groups past that threshold aren't tracked.import requests
headers = {
'Content-Type': 'application/json',
'Accept': '*/*'
}
r = requests.post['//api2.amplitude.com/2/httpapi', params={
}, headers = headers]
print r.json[]
6Optional. Boolean. When import requests
headers = {
'Content-Type': 'application/json',
'Accept': '*/*'
}
r = requests.post['//api2.amplitude.com/2/httpapi', params={
}, headers = headers]
print r.json[]
7 user properties aren't synced. Defaults to import requests
headers = {
'Content-Type': 'application/json',
'Accept': '*/*'
}
r = requests.post['//api2.amplitude.com/2/httpapi', params={
}, headers = headers]
print r.json[]
8. See for more information.import requests
headers = {
'Content-Type': 'application/json',
'Accept': '*/*'
}
r = requests.post['//api2.amplitude.com/2/httpapi', params={
}, headers = headers]
print r.json[]
9Optional. String. The current version of your application.URL obj = new URL["//api2.amplitude.com/2/httpapi"];
HttpURLConnection con = [HttpURLConnection] obj.openConnection[];
con.setRequestMethod["POST"];
int responseCode = con.getResponseCode[];
BufferedReader in = new BufferedReader[
new InputStreamReader[con.getInputStream[]]];
String inputLine;
StringBuffer response = new StringBuffer[];
while [[inputLine = in.readLine[]] != null] {
response.append[inputLine];
}
in.close[];
System.out.println[response.toString[]];
0Optional. String. Platform of the device.URL obj = new URL["//api2.amplitude.com/2/httpapi"];
HttpURLConnection con = [HttpURLConnection] obj.openConnection[];
con.setRequestMethod["POST"];
int responseCode = con.getResponseCode[];
BufferedReader in = new BufferedReader[
new InputStreamReader[con.getInputStream[]]];
String inputLine;
StringBuffer response = new StringBuffer[];
while [[inputLine = in.readLine[]] != null] {
response.append[inputLine];
}
in.close[];
System.out.println[response.toString[]];
1Optional. String. The name of the mobile operating system or browser that the user is using.URL obj = new URL["//api2.amplitude.com/2/httpapi"];
HttpURLConnection con = [HttpURLConnection] obj.openConnection[];
con.setRequestMethod["POST"];
int responseCode = con.getResponseCode[];
BufferedReader in = new BufferedReader[
new InputStreamReader[con.getInputStream[]]];
String inputLine;
StringBuffer response = new StringBuffer[];
while [[inputLine = in.readLine[]] != null] {
response.append[inputLine];
}
in.close[];
System.out.println[response.toString[]];
2Optional. String. The version of the mobile operating system or browser the user is using.URL obj = new URL["//api2.amplitude.com/2/httpapi"];
HttpURLConnection con = [HttpURLConnection] obj.openConnection[];
con.setRequestMethod["POST"];
int responseCode = con.getResponseCode[];
BufferedReader in = new BufferedReader[
new InputStreamReader[con.getInputStream[]]];
String inputLine;
StringBuffer response = new StringBuffer[];
while [[inputLine = in.readLine[]] != null] {
response.append[inputLine];
}
in.close[];
System.out.println[response.toString[]];
3Optional. String. The device brand that the user is using.URL obj = new URL["//api2.amplitude.com/2/httpapi"];
HttpURLConnection con = [HttpURLConnection] obj.openConnection[];
con.setRequestMethod["POST"];
int responseCode = con.getResponseCode[];
BufferedReader in = new BufferedReader[
new InputStreamReader[con.getInputStream[]]];
String inputLine;
StringBuffer response = new StringBuffer[];
while [[inputLine = in.readLine[]] != null] {
response.append[inputLine];
}
in.close[];
System.out.println[response.toString[]];
4Optional. String. The device manufacturer that the user is using.URL obj = new URL["//api2.amplitude.com/2/httpapi"];
HttpURLConnection con = [HttpURLConnection] obj.openConnection[];
con.setRequestMethod["POST"];
int responseCode = con.getResponseCode[];
BufferedReader in = new BufferedReader[
new InputStreamReader[con.getInputStream[]]];
String inputLine;
StringBuffer response = new StringBuffer[];
while [[inputLine = in.readLine[]] != null] {
response.append[inputLine];
}
in.close[];
System.out.println[response.toString[]];
5Optional. String. The device model that the user is using.URL obj = new URL["//api2.amplitude.com/2/httpapi"];
HttpURLConnection con = [HttpURLConnection] obj.openConnection[];
con.setRequestMethod["POST"];
int responseCode = con.getResponseCode[];
BufferedReader in = new BufferedReader[
new InputStreamReader[con.getInputStream[]]];
String inputLine;
StringBuffer response = new StringBuffer[];
while [[inputLine = in.readLine[]] != null] {
response.append[inputLine];
}
in.close[];
System.out.println[response.toString[]];
6Optional. String. The carrier that the user is using.URL obj = new URL["//api2.amplitude.com/2/httpapi"];
HttpURLConnection con = [HttpURLConnection] obj.openConnection[];
con.setRequestMethod["POST"];
int responseCode = con.getResponseCode[];
BufferedReader in = new BufferedReader[
new InputStreamReader[con.getInputStream[]]];
String inputLine;
StringBuffer response = new StringBuffer[];
while [[inputLine = in.readLine[]] != null] {
response.append[inputLine];
}
in.close[];
System.out.println[response.toString[]];
7Optional. String. The current country of the user.URL obj = new URL["//api2.amplitude.com/2/httpapi"];
HttpURLConnection con = [HttpURLConnection] obj.openConnection[];
con.setRequestMethod["POST"];
int responseCode = con.getResponseCode[];
BufferedReader in = new BufferedReader[
new InputStreamReader[con.getInputStream[]]];
String inputLine;
StringBuffer response = new StringBuffer[];
while [[inputLine = in.readLine[]] != null] {
response.append[inputLine];
}
in.close[];
System.out.println[response.toString[]];
8Optional. String. The current region of the user.URL obj = new URL["//api2.amplitude.com/2/httpapi"];
HttpURLConnection con = [HttpURLConnection] obj.openConnection[];
con.setRequestMethod["POST"];
int responseCode = con.getResponseCode[];
BufferedReader in = new BufferedReader[
new InputStreamReader[con.getInputStream[]]];
String inputLine;
StringBuffer response = new StringBuffer[];
while [[inputLine = in.readLine[]] != null] {
response.append[inputLine];
}
in.close[];
System.out.println[response.toString[]];
9Optional. String. The current city of the user.package main
import [
"bytes"
"net/http"
]
func main[] {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"*/*"},
}
data := bytes.NewBuffer[[]byte{jsonReq}]
req, err := http.NewRequest["POST", "//api2.amplitude.com/2/httpapi", data]
req.Header = headers
client := &http.Client{}
resp, err := client.Do[req]
// ...
}
0 Optional. String. The current Designated Market Area of the user.package main
import [
"bytes"
"net/http"
]
func main[] {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"*/*"},
}
data := bytes.NewBuffer[[]byte{jsonReq}]
req, err := http.NewRequest["POST", "//api2.amplitude.com/2/httpapi", data]
req.Header = headers
client := &http.Client{}
resp, err := client.Do[req]
// ...
}
1Optional. String. The language set by the user.package main
import [
"bytes"
"net/http"
]
func main[] {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"*/*"},
}
data := bytes.NewBuffer[[]byte{jsonReq}]
req, err := http.NewRequest["POST", "//api2.amplitude.com/2/httpapi", data]
req.Header = headers
client := &http.Client{}
resp, err := client.Do[req]
// ...
}
2Optional. Float. The price of the item purchased. Required for revenue data if the revenue field isn't sent. You can use negative values for refunds.package main
import [
"bytes"
"net/http"
]
func main[] {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"*/*"},
}
data := bytes.NewBuffer[[]byte{jsonReq}]
req, err := http.NewRequest["POST", "//api2.amplitude.com/2/httpapi", data]
req.Header = headers
client := &http.Client{}
resp, err := client.Do[req]
// ...
}
3Optional. Integer. The quantity of the item purchased. Defaults to 1 if not specified.package main
import [
"bytes"
"net/http"
]
func main[] {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"*/*"},
}
data := bytes.NewBuffer[[]byte{jsonReq}]
req, err := http.NewRequest["POST", "//api2.amplitude.com/2/httpapi", data]
req.Header = headers
client := &http.Client{}
resp, err := client.Do[req]
// ...
}
4Optional. Float. Revenue = [price x quantity]. If you send all 3 fields of price, quantity, and revenue, then the revenue value is [price x quantity]. Use negative values for refunds.package main
import [
"bytes"
"net/http"
]
func main[] {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"*/*"},
}
data := bytes.NewBuffer[[]byte{jsonReq}]
req, err := http.NewRequest["POST", "//api2.amplitude.com/2/httpapi", data]
req.Header = headers
client := &http.Client{}
resp, err := client.Do[req]
// ...
}
5Optional. String. An identifier for the item purchased. You must send a price and quantity or revenue with this field.package main
import [
"bytes"
"net/http"
]
func main[] {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"*/*"},
}
data := bytes.NewBuffer[[]byte{jsonReq}]
req, err := http.NewRequest["POST", "//api2.amplitude.com/2/httpapi", data]
req.Header = headers
client := &http.Client{}
resp, err := client.Do[req]
// ...
}
6Optional. String. The type of revenue for the item purchased. You must send a price and quantity or revenue with this field.package main
import [
"bytes"
"net/http"
]
func main[] {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"*/*"},
}
data := bytes.NewBuffer[[]byte{jsonReq}]
req, err := http.NewRequest["POST", "//api2.amplitude.com/2/httpapi", data]
req.Header = headers
client := &http.Client{}
resp, err := client.Do[req]
// ...
}
7Optional. Float. The current Latitude of the user.package main
import [
"bytes"
"net/http"
]
func main[] {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"*/*"},
}
data := bytes.NewBuffer[[]byte{jsonReq}]
req, err := http.NewRequest["POST", "//api2.amplitude.com/2/httpapi", data]
req.Header = headers
client := &http.Client{}
resp, err := client.Do[req]
// ...
}
8Optional. Float. The current Longitude of the user.package main
import [
"bytes"
"net/http"
]
func main[] {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"*/*"},
}
data := bytes.NewBuffer[[]byte{jsonReq}]
req, err := http.NewRequest["POST", "//api2.amplitude.com/2/httpapi", data]
req.Header = headers
client := &http.Client{}
resp, err := client.Do[req]
// ...
}
9Optional. String. The IP address of the user. Use {
"api_key": "my_amplitude_api_key",
"events": [
{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial",
"time": 1396381378123,
"event_properties": {
"load_time": 0.8371,
"source": "notification",
"dates": [
"monday",
"tuesday"
]
},
"user_properties": {
"age": 25,
"gender": "female",
"interests": [
"chess",
"football",
"music"
]
},
"groups": {
"company_id": "123",
"department_id": [
"abc",
"xyz"
]
},
"app_version": "2.1.3",
"platform": "iOS",
"os_name": "Android",
"os_version": "4.2.2",
"device_brand": "Verizon",
"device_manufacturer": "Apple",
"device_model": "iPhone 9,1",
"carrier": "Verizon",
"country": "United States",
"region": "California",
"city": "San Francisco",
"dma": "San Francisco-Oakland-San Jose, CA",
"language": "English",
"price": 4.99,
"quantity": 3,
"revenue": -1.99,
"productId": "Google Pay Store Product Id",
"revenueType": "Refund",
"location_lat": 37.77,
"location_lng": -122.39,
"ip": "127.0.0.1",
"idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"idfv": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"adid": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"android_id": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"event_id": 23,
"session_id": 1396381378123,
"insert_id": "5f0adeff-6668-4427-8d02-57d803a2b841"
}
]
}
0 to use the IP address on the upload request. Amplitude uses the IP address to reverse lookup a user's location [city, country, region, and DMA]. Amplitude can drop the location and IP address from events after they reach Amplitude servers. Contact the Support team to configure this.{
"api_key": "my_amplitude_api_key",
"events": [
{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial",
"time": 1396381378123,
"event_properties": {
"load_time": 0.8371,
"source": "notification",
"dates": [
"monday",
"tuesday"
]
},
"user_properties": {
"age": 25,
"gender": "female",
"interests": [
"chess",
"football",
"music"
]
},
"groups": {
"company_id": "123",
"department_id": [
"abc",
"xyz"
]
},
"app_version": "2.1.3",
"platform": "iOS",
"os_name": "Android",
"os_version": "4.2.2",
"device_brand": "Verizon",
"device_manufacturer": "Apple",
"device_model": "iPhone 9,1",
"carrier": "Verizon",
"country": "United States",
"region": "California",
"city": "San Francisco",
"dma": "San Francisco-Oakland-San Jose, CA",
"language": "English",
"price": 4.99,
"quantity": 3,
"revenue": -1.99,
"productId": "Google Pay Store Product Id",
"revenueType": "Refund",
"location_lat": 37.77,
"location_lng": -122.39,
"ip": "127.0.0.1",
"idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"idfv": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"adid": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"android_id": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"event_id": 23,
"session_id": 1396381378123,
"insert_id": "5f0adeff-6668-4427-8d02-57d803a2b841"
}
]
}
1Optional. String. [iOS] Identifier for Advertiser.{
"api_key": "my_amplitude_api_key",
"events": [
{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial",
"time": 1396381378123,
"event_properties": {
"load_time": 0.8371,
"source": "notification",
"dates": [
"monday",
"tuesday"
]
},
"user_properties": {
"age": 25,
"gender": "female",
"interests": [
"chess",
"football",
"music"
]
},
"groups": {
"company_id": "123",
"department_id": [
"abc",
"xyz"
]
},
"app_version": "2.1.3",
"platform": "iOS",
"os_name": "Android",
"os_version": "4.2.2",
"device_brand": "Verizon",
"device_manufacturer": "Apple",
"device_model": "iPhone 9,1",
"carrier": "Verizon",
"country": "United States",
"region": "California",
"city": "San Francisco",
"dma": "San Francisco-Oakland-San Jose, CA",
"language": "English",
"price": 4.99,
"quantity": 3,
"revenue": -1.99,
"productId": "Google Pay Store Product Id",
"revenueType": "Refund",
"location_lat": 37.77,
"location_lng": -122.39,
"ip": "127.0.0.1",
"idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"idfv": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"adid": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"android_id": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"event_id": 23,
"session_id": 1396381378123,
"insert_id": "5f0adeff-6668-4427-8d02-57d803a2b841"
}
]
}
2Optional. String. [iOS] Identifier for Vendor.{
"api_key": "my_amplitude_api_key",
"events": [
{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial",
"time": 1396381378123,
"event_properties": {
"load_time": 0.8371,
"source": "notification",
"dates": [
"monday",
"tuesday"
]
},
"user_properties": {
"age": 25,
"gender": "female",
"interests": [
"chess",
"football",
"music"
]
},
"groups": {
"company_id": "123",
"department_id": [
"abc",
"xyz"
]
},
"app_version": "2.1.3",
"platform": "iOS",
"os_name": "Android",
"os_version": "4.2.2",
"device_brand": "Verizon",
"device_manufacturer": "Apple",
"device_model": "iPhone 9,1",
"carrier": "Verizon",
"country": "United States",
"region": "California",
"city": "San Francisco",
"dma": "San Francisco-Oakland-San Jose, CA",
"language": "English",
"price": 4.99,
"quantity": 3,
"revenue": -1.99,
"productId": "Google Pay Store Product Id",
"revenueType": "Refund",
"location_lat": 37.77,
"location_lng": -122.39,
"ip": "127.0.0.1",
"idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"idfv": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"adid": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"android_id": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"event_id": 23,
"session_id": 1396381378123,
"insert_id": "5f0adeff-6668-4427-8d02-57d803a2b841"
}
]
}
3Optional. String. [Android] Google Play Services advertising ID{
"api_key": "my_amplitude_api_key",
"events": [
{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial",
"time": 1396381378123,
"event_properties": {
"load_time": 0.8371,
"source": "notification",
"dates": [
"monday",
"tuesday"
]
},
"user_properties": {
"age": 25,
"gender": "female",
"interests": [
"chess",
"football",
"music"
]
},
"groups": {
"company_id": "123",
"department_id": [
"abc",
"xyz"
]
},
"app_version": "2.1.3",
"platform": "iOS",
"os_name": "Android",
"os_version": "4.2.2",
"device_brand": "Verizon",
"device_manufacturer": "Apple",
"device_model": "iPhone 9,1",
"carrier": "Verizon",
"country": "United States",
"region": "California",
"city": "San Francisco",
"dma": "San Francisco-Oakland-San Jose, CA",
"language": "English",
"price": 4.99,
"quantity": 3,
"revenue": -1.99,
"productId": "Google Pay Store Product Id",
"revenueType": "Refund",
"location_lat": 37.77,
"location_lng": -122.39,
"ip": "127.0.0.1",
"idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"idfv": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"adid": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"android_id": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"event_id": 23,
"session_id": 1396381378123,
"insert_id": "5f0adeff-6668-4427-8d02-57d803a2b841"
}
]
}
4Optional. String. [Android] Android ID [not the advertising ID]{
"api_key": "my_amplitude_api_key",
"events": [
{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial",
"time": 1396381378123,
"event_properties": {
"load_time": 0.8371,
"source": "notification",
"dates": [
"monday",
"tuesday"
]
},
"user_properties": {
"age": 25,
"gender": "female",
"interests": [
"chess",
"football",
"music"
]
},
"groups": {
"company_id": "123",
"department_id": [
"abc",
"xyz"
]
},
"app_version": "2.1.3",
"platform": "iOS",
"os_name": "Android",
"os_version": "4.2.2",
"device_brand": "Verizon",
"device_manufacturer": "Apple",
"device_model": "iPhone 9,1",
"carrier": "Verizon",
"country": "United States",
"region": "California",
"city": "San Francisco",
"dma": "San Francisco-Oakland-San Jose, CA",
"language": "English",
"price": 4.99,
"quantity": 3,
"revenue": -1.99,
"productId": "Google Pay Store Product Id",
"revenueType": "Refund",
"location_lat": 37.77,
"location_lng": -122.39,
"ip": "127.0.0.1",
"idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"idfv": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"adid": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"android_id": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"event_id": 23,
"session_id": 1396381378123,
"insert_id": "5f0adeff-6668-4427-8d02-57d803a2b841"
}
]
}
5Optional. Integer. [Optional] An incrementing counter to distinguish events with the same POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
6 and timestamp from each other. Amplitude recommends you send an {
"api_key": "my_amplitude_api_key",
"events": [
{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial",
"time": 1396381378123,
"event_properties": {
"load_time": 0.8371,
"source": "notification",
"dates": [
"monday",
"tuesday"
]
},
"user_properties": {
"age": 25,
"gender": "female",
"interests": [
"chess",
"football",
"music"
]
},
"groups": {
"company_id": "123",
"department_id": [
"abc",
"xyz"
]
},
"app_version": "2.1.3",
"platform": "iOS",
"os_name": "Android",
"os_version": "4.2.2",
"device_brand": "Verizon",
"device_manufacturer": "Apple",
"device_model": "iPhone 9,1",
"carrier": "Verizon",
"country": "United States",
"region": "California",
"city": "San Francisco",
"dma": "San Francisco-Oakland-San Jose, CA",
"language": "English",
"price": 4.99,
"quantity": 3,
"revenue": -1.99,
"productId": "Google Pay Store Product Id",
"revenueType": "Refund",
"location_lat": 37.77,
"location_lng": -122.39,
"ip": "127.0.0.1",
"idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"idfv": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"adid": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"android_id": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"event_id": 23,
"session_id": 1396381378123,
"insert_id": "5f0adeff-6668-4427-8d02-57d803a2b841"
}
]
}
5, increasing over time, especially if you expect events to occur simultaneously.{
"api_key": "my_amplitude_api_key",
"events": [
{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial",
"time": 1396381378123,
"event_properties": {
"load_time": 0.8371,
"source": "notification",
"dates": [
"monday",
"tuesday"
]
},
"user_properties": {
"age": 25,
"gender": "female",
"interests": [
"chess",
"football",
"music"
]
},
"groups": {
"company_id": "123",
"department_id": [
"abc",
"xyz"
]
},
"app_version": "2.1.3",
"platform": "iOS",
"os_name": "Android",
"os_version": "4.2.2",
"device_brand": "Verizon",
"device_manufacturer": "Apple",
"device_model": "iPhone 9,1",
"carrier": "Verizon",
"country": "United States",
"region": "California",
"city": "San Francisco",
"dma": "San Francisco-Oakland-San Jose, CA",
"language": "English",
"price": 4.99,
"quantity": 3,
"revenue": -1.99,
"productId": "Google Pay Store Product Id",
"revenueType": "Refund",
"location_lat": 37.77,
"location_lng": -122.39,
"ip": "127.0.0.1",
"idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"idfv": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"adid": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"android_id": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"event_id": 23,
"session_id": 1396381378123,
"insert_id": "5f0adeff-6668-4427-8d02-57d803a2b841"
}
]
}
8Optional. Long. The start time of the session in milliseconds since epoch [Unix Timestamp], necessary if you want to associate events with a particular system. A {
"api_key": "my_amplitude_api_key",
"events": [
{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial",
"time": 1396381378123,
"event_properties": {
"load_time": 0.8371,
"source": "notification",
"dates": [
"monday",
"tuesday"
]
},
"user_properties": {
"age": 25,
"gender": "female",
"interests": [
"chess",
"football",
"music"
]
},
"groups": {
"company_id": "123",
"department_id": [
"abc",
"xyz"
]
},
"app_version": "2.1.3",
"platform": "iOS",
"os_name": "Android",
"os_version": "4.2.2",
"device_brand": "Verizon",
"device_manufacturer": "Apple",
"device_model": "iPhone 9,1",
"carrier": "Verizon",
"country": "United States",
"region": "California",
"city": "San Francisco",
"dma": "San Francisco-Oakland-San Jose, CA",
"language": "English",
"price": 4.99,
"quantity": 3,
"revenue": -1.99,
"productId": "Google Pay Store Product Id",
"revenueType": "Refund",
"location_lat": 37.77,
"location_lng": -122.39,
"ip": "127.0.0.1",
"idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"idfv": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"adid": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"android_id": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"event_id": 23,
"session_id": 1396381378123,
"insert_id": "5f0adeff-6668-4427-8d02-57d803a2b841"
}
]
}
8 of -1 is the same as no {
"api_key": "my_amplitude_api_key",
"events": [
{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial",
"time": 1396381378123,
"event_properties": {
"load_time": 0.8371,
"source": "notification",
"dates": [
"monday",
"tuesday"
]
},
"user_properties": {
"age": 25,
"gender": "female",
"interests": [
"chess",
"football",
"music"
]
},
"groups": {
"company_id": "123",
"department_id": [
"abc",
"xyz"
]
},
"app_version": "2.1.3",
"platform": "iOS",
"os_name": "Android",
"os_version": "4.2.2",
"device_brand": "Verizon",
"device_manufacturer": "Apple",
"device_model": "iPhone 9,1",
"carrier": "Verizon",
"country": "United States",
"region": "California",
"city": "San Francisco",
"dma": "San Francisco-Oakland-San Jose, CA",
"language": "English",
"price": 4.99,
"quantity": 3,
"revenue": -1.99,
"productId": "Google Pay Store Product Id",
"revenueType": "Refund",
"location_lat": 37.77,
"location_lng": -122.39,
"ip": "127.0.0.1",
"idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"idfv": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"adid": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"android_id": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"event_id": 23,
"session_id": 1396381378123,
"insert_id": "5f0adeff-6668-4427-8d02-57d803a2b841"
}
]
}
8 specified.var headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
$.ajax[{
url: '//api2.amplitude.com/2/httpapi',
method: 'post',
headers: headers,
success: function[data] {
console.log[JSON.stringify[data]];
}
}]
4Optional. String. A unique identifier for the event. Amplitude deduplicates subsequent events sent with the same POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
5 and var headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
$.ajax[{
url: '//api2.amplitude.com/2/httpapi',
method: 'post',
headers: headers,
success: function[data] {
console.log[JSON.stringify[data]];
}
}]
4 within the past 7 days. Amplitude recommends generating a UUID or using some combination of POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
5, POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
6, const request = require['node-fetch'];
const inputBody = '{
"api_key": "my_amplitude_api_key",
"events": [
{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial",
"time": 1396381378123,
"event_properties": {
"load_time": 0.8371,
"source": "notification",
"dates": [
"monday",
"tuesday"
]
},
"user_properties": {
"age": 25,
"gender": "female",
"interests": [
"chess",
"football",
"music"
]
},
"groups": {
"company_id": "123",
"department_id": [
"abc",
"xyz"
]
},
"app_version": "2.1.3",
"platform": "iOS",
"os_name": "Android",
"os_version": "4.2.2",
"device_brand": "Verizon",
"device_manufacturer": "Apple",
"device_model": "iPhone 9,1",
"carrier": "Verizon",
"country": "United States",
"region": "California",
"city": "San Francisco",
"dma": "San Francisco-Oakland-San Jose, CA",
"language": "English",
"price": 4.99,
"quantity": 3,
"revenue": -1.99,
"productId": "Google Pay Store Product Id",
"revenueType": "Refund",
"location_lat": 37.77,
"location_lng": -122.39,
"ip": "127.0.0.1",
"idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"idfv": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"adid": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"android_id": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"event_id": 23,
"session_id": 1396381378123,
"insert_id": "5f0adeff-6668-4427-8d02-57d803a2b841"
}
]
}';
const headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
fetch['//api2.amplitude.com/2/httpapi',
{
method: 'POST',
body: inputBody,
headers: headers
}]
.then[function[res] {
return res.json[];
}].then[function[body] {
console.log[body];
}];
7, {
"api_key": "my_amplitude_api_key",
"events": [
{
"user_id": "203201202",
"device_id": "C8F9E604-F01A-4BD9-95C6-8E5357DF265D",
"event_type": "watch_tutorial",
"time": 1396381378123,
"event_properties": {
"load_time": 0.8371,
"source": "notification",
"dates": [
"monday",
"tuesday"
]
},
"user_properties": {
"age": 25,
"gender": "female",
"interests": [
"chess",
"football",
"music"
]
},
"groups": {
"company_id": "123",
"department_id": [
"abc",
"xyz"
]
},
"app_version": "2.1.3",
"platform": "iOS",
"os_name": "Android",
"os_version": "4.2.2",
"device_brand": "Verizon",
"device_manufacturer": "Apple",
"device_model": "iPhone 9,1",
"carrier": "Verizon",
"country": "United States",
"region": "California",
"city": "San Francisco",
"dma": "San Francisco-Oakland-San Jose, CA",
"language": "English",
"price": 4.99,
"quantity": 3,
"revenue": -1.99,
"productId": "Google Pay Store Product Id",
"revenueType": "Refund",
"location_lat": 37.77,
"location_lng": -122.39,
"ip": "127.0.0.1",
"idfa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"idfv": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"adid": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"android_id": "BCCE52E7-03EE-321A-B3D4-E57123966239",
"event_id": 23,
"session_id": 1396381378123,
"insert_id": "5f0adeff-6668-4427-8d02-57d803a2b841"
}
]
}
5, and time.{
"code": 200,
"events_ingested": 50,
"payload_size_bytes": 50,
"server_upload_time": 1396381378123
}
8Optional. Object. Tracking plan properties. Amplitude supports only branch, source, version properties.{
"code": 200,
"events_ingested": 50,
"payload_size_bytes": 50,
"server_upload_time": 1396381378123
}
9Optional. String. The tracking plan branch name. For example: "main".POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
00Optional. String. The tracking plan source. For example: "web".POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
01Optional. String. The tracking plan version. For example: "1", "15".Options
Name
Descriptionvar headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
$.ajax[{
url: '//api2.amplitude.com/2/httpapi',
method: 'post',
headers: headers,
success: function[data] {
console.log[JSON.stringify[data]];
}
}]
8Optional. Integer. Overrides the default minimum length of 5 for POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
6 & POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
5 fields.Response format
It's best practice to implement retry logic and send an
var headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
$.ajax[{
url: '//api2.amplitude.com/2/httpapi',
method: 'post',
headers: headers,
success: function[data] {
console.log[JSON.stringify[data]];
}
}]
4 [used for deduplication of the same event] in your events. This prevents lost events or duplicated events if the API is unavailable or a request fails.200 response SuccessSummary
: Successful real time event upload. If you don't receive a
POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
06 response, retry your request.{
"code": 200,
"events_ingested": 50,
"payload_size_bytes": 50,
"server_upload_time": 1396381378123
}
Properties
Name
DescriptionPOST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
07Integer. 200 success codePOST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
08Integer. The number of events ingested from the upload request.POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
09Integer. The size of the upload request payload in bytes.POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
10Long. The time in milliseconds since epoch [Unix Timestamp] that Amplitude's event servers accepted the upload request.400 response InvalidRequestError
. A 400 indicates invalid upload request. Check the response for more information.
Possible reasons for an invalid request:
- The request body isn't valid JSON. The
11 returned is "Invalid JSON request body".POST https//api2.amplitude.com/2/httpapi HTTP/1.1 Host: api2.amplitude.com Content-Type: application/json Accept: */*
- The request body is missing required fields. The
11 returned is "Request missing required field", and indicates which fields are missing.POST https//api2.amplitude.com/2/httpapi HTTP/1.1 Host: api2.amplitude.com Content-Type: application/json Accept: */*
- The events object has invalid fields.
13 maps field names to an array of indexes indicating the events with invalid values.POST https//api2.amplitude.com/2/httpapi HTTP/1.1 Host: api2.amplitude.com Content-Type: application/json Accept: */*
- Some devices have been silenced.
Invalid fields exampleSilenced devices example
POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
0POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
1Properties [invalid or missing JSON]
Name
DescriptionPOST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
07Integer. 400 error codePOST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
11String. Error description. Possible values are POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
16, POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
17, POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
18, POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
19, POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
20, POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
21, POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
22POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
23String. Indicates which request-level required field is missing.POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
13Object. A map from field names to an array of indexes into the events array indicating which events have invalid values for those fieldsPOST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
25Object. A map from field names to an array of indexes into the events array indicating which events are missing those required fieldsProperties [SilencedDeviceID]
Name
DescriptionPOST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
07Integer. 400 error codePOST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
11String. Error description.POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
28Integer. Your app's current events per second threshold. If you exceed this rate your requests are throttled.POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
29Object. A map from device_id to its current number of daily events, for all devices that exceed the app's daily event quota.POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
30[string]. Array of POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
5s that Amplitude has silenced.POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
32[integer]. Array of indexes in the events array indicating events whose device_id got silenced.POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
33Object. A map from device_id to its current events per second rate, for all devices that exceed the app's current threshold.POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
34[integer]. Array of indexes in the events array indicating events whose POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
6 or POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
5 got throttled413 response PayloadTooLargeError
. The payload size is too big [request size exceeds 1MB]. Split your events array payload into multiple requests and try again.
POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
2Properties
NameDescriptionPOST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
07Integer. 413 error codePOST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
11String. Error description.429 response TooManyRequestsForDeviceError
. Too many requests for a user or device. Amplitude throttles requests for users and devices that exceed 30 events per second [measured as an average over a recent time window]. You should pause sending events for that user or device for a period of 30 seconds before retrying and continue retrying until you no longer receive a 429 response.
POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
3Properties
Name
DescriptionPOST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
07Integer. 429 error codePOST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
11String. Error description.POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
28Integer. Your app's current events per second threshold. If you exceed this rate your requests are throttled.POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
33Object. A map from POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
5 to its current events per second rate, for all devices that exceed the app's current threshold.POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
44Object. A map from POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
6 to their current events per second rate, for all users that exceed the app's current threshold.POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
34Array of indexes in the events array indicating events whose POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
6 or POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
5 were throttled.Server Error 500, 502, 504
500, 502, and 504 . Amplitude encountered an error while handling the request. A request with this response may not have been accepted by Amplitude. If you retry the request, it could duplicate the events. To avoid duplication, send an
var headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
$.ajax[{
url: '//api2.amplitude.com/2/httpapi',
method: 'post',
headers: headers,
success: function[data] {
console.log[JSON.stringify[data]];
}
}]
4 in your requests.503 Service Unavailable
. Request failed because of an internal Amplitude issue. Retrying a request with a
POST https//api2.amplitude.com/2/httpapi HTTP/1.1
Host: api2.amplitude.com
Content-Type: application/json
Accept: */*
50 response doesn't risk duplicating events.
51,POST https//api2.amplitude.com/2/httpapi HTTP/1.1 Host: api2.amplitude.com Content-Type: application/json Accept: */*
52,POST https//api2.amplitude.com/2/httpapi HTTP/1.1 Host: api2.amplitude.com Content-Type: application/json Accept: */*
53, andPOST https//api2.amplitude.com/2/httpapi HTTP/1.1 Host: api2.amplitude.com Content-Type: application/json Accept: */*
54 are user properties pulled using GeoIP. Amplitude uses MaxMind's database, which is widely accepted as the most reliable digital mapping source, to look up location information from the user's IP address. For any HTTP API events, if GeoIP information is unavailable, then Amplitude pulls the information from thePOST https//api2.amplitude.com/2/httpapi HTTP/1.1 Host: api2.amplitude.com Content-Type: application/json Accept: */*
7 andpackage main import [ "bytes" "net/http" ] func main[] { headers := map[string][]string{ "Content-Type": []string{"application/json"}, "Accept": []string{"*/*"}, } data := bytes.NewBuffer[[]byte{jsonReq}] req, err := http.NewRequest["POST", "//api2.amplitude.com/2/httpapi", data] req.Header = headers client := &http.Client{} resp, err := client.Do[req] // ... }
8 keys if those keys have values. If the location properties are manually set, then Amplitude doesn't change that property.package main import [ "bytes" "net/http" ] func main[] { headers := map[string][]string{ "Content-Type": []string{"application/json"}, "Accept": []string{"*/*"}, } data := bytes.NewBuffer[[]byte{jsonReq}] req, err := http.NewRequest["POST", "//api2.amplitude.com/2/httpapi", data] req.Header = headers client := &http.Client{} resp, err := client.Do[req] // ... }
These values appear as
57 in Amplitude. For privacy reasons, Amplitude processes the attribution information, but strips the values before saving the event in the system.POST https//api2.amplitude.com/2/httpapi HTTP/1.1 Host: api2.amplitude.com Content-Type: application/json Accept: */*