On this page

Lookup Table API 2

Regions

The base URL depends on your project's data residency. In all examples on this page, use the default base URL unless your project uses Amplitude's EU data center—in that case use the EU base URL in this table.

This API uses data-api.amplitude.com (default) or data-api.eu.amplitude.com (EU). Event ingestion uses api2.amplitude.com or api.amplitude.com; Experiment Management uses experiment.amplitude.com. The https://analytics.amplitude.com hostname is the Analytics web app (browser UI), not this API endpoint.

CSV file requirements

The CSV file must follow these requirements:

  • Maximum file size is 100 MB. The file can't have more than 1,000,000 rows.
  • The first row must contain column names or headers.
  • The first column must correspond to the mapping property value and must contain unique values. Lookup tables search for exact matches and are case-sensitive.
  • Separate columns with commas.
  • Separate rows with line breaks.
  • If a field value contains commas or quotes, wrap the value in double quotation marks. The first double quote signifies the beginning of the column data, and the last double quote marks the end. If the value contains a string with double quotes, Amplitude replaces those quotes with two double quotes "".

Create a Lookup Table

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 multipart/form-data content type.

Parameters

Example request

curl
curl -L -X POST 'https://data-api.amplitude.com/api/3/lookup_table' \
        -u API_KEY:SECRET_KEY \
        -F 'file=@"/path/to/file.csv";type=text/csv' \
        -F 'name=":name"' \
        -F 'key=":key"' \
        -F 'property="{\"value\": \":propertyName\", \"type\": \":propertyType\", \"groupType\":  \":propertyGroupType\"}";type=application/json'

Response

json
{
  "appId": "<projectId>",
  "name": "example-lookup",
  "columnHeaders": ["Language"],
  "createdAt": 1715912516,
  "createdBy": "api",
  "lastModifiedAt": 1715912516,
  "lastModifiedBy": "api",
  "isDeleted": false,
  "isConfigured": true,
  "keyColumnHeader": "SKU",
  "keyProperty": {
    "type": "event",
    "value": "example",
    "groupType": "User"
  },
  "fileName": "lookup-table-example.csv",
  "rowCount": 3,
  "sizeBytes": 0
}

Retrieve a Lookup Table

Retrieve a lookup table by its name.

Parameters

Example request

curl
curl -L -X GET 'https://data-api.amplitude.com/api/3/lookup_table/:name' \
        -u API_KEY:SECRET_KEY

Response

json
{
  "appId": "<projectId>",
  "name": "example-lookup",
  "columnHeaders": ["Language"],
  "createdAt": 1715912516,
  "createdBy": "api",
  "lastModifiedAt": 1715912516,
  "lastModifiedBy": "api",
  "isDeleted": false,
  "isConfigured": true,
  "keyColumnHeader": "SKU",
  "keyProperty": {
    "type": "event",
    "value": "example",
    "groupType": "User"
  },
  "fileName": "lookup-table-example.csv",
  "rowCount": 3,
  "sizeBytes": 5
}

Download a CSV

Download the lookup table object as a CSV. Any incremental changes are applied in the downloaded file.

Parameters

Example request

curl
curl -L -X GET 'https://data-api.amplitude.com/api/3/lookup_table/:name/csv' \
        -u API_KEY:SECRET_KEY

Override a Lookup Table

Override a lookup table object by uploading a CSV that replaces the CSV already uploaded to Amplitude. Send the request with the multipart/form-data content type.

Parameters

Example request

curl
curl -L -X PUT 'https://data-api.amplitude.com/api/3/lookup_table/:name' \
        -u API_KEY:SECRET_KEY \
        -F 'file=@"/path/to/file.csv";type=text/csv' \
        -F 'property="{\"value\": \":propertyName\", \"type\": \":propertyType\", \"groupType\":  \":propertyGroupType\"}";type=application/json'

Response

json
{
  "appId": "<projectId>",
  "name": "example-lookup",
  "columnHeaders": ["Language"],
  "createdAt": 1715912516,
  "createdBy": "api",
  "lastModifiedAt": 1715912516,
  "lastModifiedBy": "api",
  "isDeleted": false,
  "isConfigured": true,
  "keyColumnHeader": "SKU",
  "keyProperty": {
    "type": "event",
    "value": "example",
    "groupType": "User"
  },
  "fileName": "lookup-table-example.csv",
  "rowCount": 3,
  "sizeBytes": 0
}

Update a Lookup Table

Update a lookup table's columns and data. If you provide a CSV file, Amplitude merges the file with the existing CSV. This supports incremental updates of the CSV instead of a complete replacement.

Parameters

Example request

curl
curl -L -X PATCH 'https://data-api.amplitude.com/api/3/lookup_table/:name' \
        -u API_KEY:SECRET_KEY
        -F 'file=@"/path/to/file.csv";type=text/csv' \
        -F 'property="{\"value\": \":propertyName\", \"type\": \":propertyType\", \"groupType\":  \":propertyGroupType\"}";type=application/json'

Response

json
{
  "appId": "<projectId>",
  "name": "example-lookup",
  "columnHeaders": ["Language"],
  "createdAt": 1715912516,
  "createdBy": "api",
  "lastModifiedAt": 1715912516,
  "lastModifiedBy": "api",
  "isDeleted": false,
  "isConfigured": true,
  "keyColumnHeader": "SKU",
  "keyProperty": {
    "type": "event",
    "value": "example",
    "groupType": "User"
  },
  "fileName": "lookup-table-example.csv",
  "rowCount": 3,
  "sizeBytes": 0
}

Delete a Lookup Table

Delete a Lookup Table.

Parameters

Example request

curl
curl -L -X DELETE 'https://data-api.amplitude.com/api/3/lookup_table/:name' \
        -u API_KEY:SECRET_KEY

Response

json
{
  "message": "Lookup table <:name> deleted successfully",
  "success": true
}

List all Lookup Tables

List all the Lookup Tables for the project.

Example request

curl
curl -L -X GET 'https://data-api.amplitude.com/api/3/lookup_table' \
        -u API_KEY:SECRET_KEY

Response

json
[
  {
    "appId": "<projectId>",
    "name": "example-lookup",
    "columnHeaders": ["Language"],
    "createdAt": 1715912516,
    "createdBy": "api",
    "lastModifiedAt": 1715912516,
    "lastModifiedBy": "api",
    "isDeleted": false,
    "isConfigured": true,
    "keyColumnHeader": "SKU",
    "keyProperty": {
      "type": "event",
      "value": "example",
      "groupType": "User"
    },
    "fileName": "lookup-table-example.csv",
    "rowCount": 3,
    "sizeBytes": 5
  },
  {
    "appId": "<projectId>",
    "name": "example-lookup-2",
    "columnHeaders": ["Language"],
    "createdAt": 1715912516,
    "createdBy": "api",
    "lastModifiedAt": 1715912516,
    "lastModifiedBy": "api",
    "isDeleted": false,
    "isConfigured": true,
    "keyColumnHeader": "SKU",
    "keyProperty": {
      "type": "event",
      "value": "example",
      "groupType": "User"
    },
    "fileName": "lookup-table-example.csv",
    "rowCount": 50,
    "sizeBytes": 10
  }
]

Error codes

All lookup table APIs share these common error codes.

Structure

Types

Was this helpful?