Lookup tables let you augment user and event properties. Instead of using formulas, you can upload a CSV file that contains property mappings to derive new properties.
To create a lookup property, create a lookup table to reference. You can retrieve and update each of the tables using the API. Lookup Tables are identified by the name and are scoped per project.
This API uses basic authentication, using the API key and secret key for your project. Pass base64-encoded credentials in the request header like {api-key}:{secret-key}
. api-key
replaces username, and secret-key
replaces the password.
Your authorization header should look something like this:
--header 'Authorization: Basic YWhhbWwsdG9uQGFwaWdlZS5jb206bClwYXNzdzByZAo'`
For more information, see Find your API Credentials
Region | Endpoint |
---|---|
Standard server | https://amplitude.com/api/2/lookup_table |
EU residency server | https://analytics.eu.amplitude.com/api/2/lookup_table |
This API is no longer supported. Use the new API.
The CSV file must meet the following requirements:
""
.Create a Lookup Table object by uploading a CSV that maps an existing property to the new properties to create. Send the request with the type multipart/form-data type.
Name |
Description |
---|---|
name |
Required. String. Name of the table. |
file |
Required. File. A CSV representation of the mappings. |
1curl -L -X POST 'https://amplitude.com/api/2/lookup_table/:name' \2 -u API_KEY:SECRET_KEY \3 -F 'file=@"/path/to/file.csv"' \
1POST '/api/2/lookup_table/:name' HTTP/1.1 2Host: api2.amplitude.com 3Authorization: Basic {api-key}:{secret-key} 4Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW 5 6----WebKitFormBoundary7MA4YWxkTrZu0gW 7Content-Disposition: form-data; name=":name"; filename="file.csv" 8Content-Type: text/csv 9 10(data)11----WebKitFormBoundary7MA4YWxkTrZu0gW
1{ 2 "name": "skuToMetadata", 3 "column_headers": [ 4 "Product Category", 5 "Product Name" 6 ], 7 "created_at": "2021-07-15T21:04:23.000593", 8 "created_by": "rest", 9 "last_modified_at": "2021-07-16T19:14:11.627477",10 "last_modified_by": "rest"11}
1HTTP 400: Bad Request
text/csv
, text/plain
, and text/tab-separated-values
.1HTTP 409: Conflict (Conflict, name already exists)
The table already exists
1HTTP 413: Payload Too Large
The file exceeds the max size.
Retrieve a Lookup Table by its name.
Name |
Description |
---|---|
name |
Required. String. Name of the table. |
1curl -L -X GET 'https://amplitude.com/api/2/lookup_table/:name' \2 -u API_KEY:SECRET_KEY
1GET /api/2/lookup_table/:name HTTP/1.12Host: amplitude.com3Authorization: Basic {api-key}:{secret-key}
1{ 2 "name": "skuToMetadata", 3 "column_headers": [ 4 "Product Category", 5 "Product Name" 6 ], 7 "created_at": "2021-07-15T21:04:23.000593", 8 "created_by": "rest", 9 "last_modified_at": "2021-07-16T19:14:11.627477",10 "last_modified_by": "rest"11}
1HTTP 404: Not found
The table wasn't found because it wasn't created
Update a Lookup Table's columns and data.
Name |
Description |
---|---|
name |
Required. String. Name of the table. |
file |
Required. File. A CSV representation of the mappings. |
1curl -L -X PATCH 'https://amplitude.com/api/2/lookup_table/:name' \2 -u API_KEY:SECRET_KEY3 -F 'file=@"/path/to/file.csv"' \
1PATCH /api/2/lookup_table/:name HTTP/1.1 2Host: amplitude.com 3Authorization: Basic {api-key}:{secret-key} 4Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW 5 6----WebKitFormBoundary7MA4YWxkTrZu0gW 7Content-Disposition: form-data; name=":name"; filename="file.csv" 8Content-Type: text/csv 9 10(data)11----WebKitFormBoundary7MA4YWxkTrZu0gW
1{ 2 "name": "skuToMetadata", 3 "column_headers": [ 4 "Product Category", 5 "Product Name" 6 ], 7 "created_at": "2021-07-15T21:04:23.000593", 8 "created_by": "rest", 9 "last_modified_at": "2021-07-16T19:14:11.627477",10 "last_modified_by": "rest"11}
1HTTP 400: Bad Request
text/csv
, text/plain
, and text/tab-separated-values
.1HTTP 404: Not found
The table wasn't found because it wasn't created
1 2HTTP 413: Payload Too Large
The file exceeds the max size.
Delete a Lookup Table.
Name |
Description |
---|---|
name |
Required. String. Name of the table. |
force |
Optional. Boolean. Delete the associated properties. Defaults to false . |
1curl -L -X DELETE 'https://amplitude.com/api/2/lookup_table/:name' \2 -u API_KEY:SECRET_KEY
1DELETE /api/2/lookup_table/:lookup_table_name?force=True HTTP/1.12Host: amplitude.com3Authorization: Basic {api-key}:{secret-key}
1{2 "name": "skuToMetadata",3 "success": true4}
1 2HTTP 404: Not found
The table wasn't found.
List all the Lookup Tables for the project.
1curl -L -X GET 'https://amplitude.com/api/2/lookup_table' \2 -u API_KEY:SECRET_KEY
1GET /api/2/lookup_table HTTP/1.12Host: amplitude.com3Authorization: Basic :
1{ 2 "data": [ 3 { 4 "name": "isbnToMetadata", 5 "column_headers": [ 6 "Genres", 7 "Authors" 8 ], 9 "created_at": "2021-07-15T21:04:23.000593",10 "created_by": "rest",11 "last_modified_at": "2021-07-16T19:14:11.627477",12 "last_modified_by": "rest"13 },14 {15 "name": "skuToMetadata",16 "column_headers": [17 "Product Category",18 "Product Name"19 ],20 "created_at": "2021-07-16T19:28:18.070073",21 "created_by": "rest",22 "last_modified_at": "2021-07-16T19:28:18.070073",23 "last_modified_by": "rest"24 }25 ]26}
Thanks for your feedback!
May 21st, 2024
Need help? Contact Support
Visit Amplitude.com
Have a look at the Amplitude Blog
Learn more at Amplitude Academy
© 2024 Amplitude, Inc. All rights reserved. Amplitude is a registered trademark of Amplitude, Inc.