Postback API Quickstart

The Postback API allows you to create custom webhooks within your applications to upload your data into Treasure Data. Treasure Data’s Postback API provides another option to import data into Treasure Data, when other methods aren’t viable.

Common use cases for Postback API might be a security limitation of an external system or inability to install a binary file.

For instance, if you want to import single records into Treasure Data where the import is triggered by an external application, Postback API allows you to include webhooks in your applications that will insert a record into a Treasure Data database when you can’t install a jar file such as TD Logger to send data into TD.

Another example could be a web based application or environment where the TD JavaScript SDK is not an option.

Setup

Instructions

Sending a Request

To send data via the postback API is very simple. Add your TD API key as a header, put the database and table in the URL, and include your data in the post request body.

It is recommended that you send your data as a JSON payload.

Parameter Description
database Specify destination database name in URL. Only alphabets/numbers or _ are allowed.
table Specify destination table name in URL. Only alphabets/numbers or _ are allowed.

Sample Request

Copy
Copied
curl -I -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: TD1 XXXX' \
  --data-binary '{"param1":"value1", "param2":1234}' \
  https://in.treasuredata.com/postback/v3/event/DATABASE/TABLE

Sample Response

{
  'time': '1448344701',
  'param1': 'value1',
  'param2': 1234
}

Further Reading

Support
Copyright © 2021 Treasure Data, Inc. (or its affiliates). All rights reserved.