Skip to main content

Quickstart with ingestion REST API

You can call the ingestion REST API to push data to Timeplus, with any preferred languages.

With the recent enhancements of the ingest API, in many cases, you can configure other systems to push data directly to Timeplus via webhook, without writing code.

In this quickstart guide, you will push JSON documents one by one to the targeted stream foo. Please check this document for more details.

Step 1: Create the target stream

Timeplus provides many options to push data as a single document or in a batch with multiple documents, or as a flexible schema or fixed schema. For the sake of simplicity, in this tutorial, you will post JSON documents like this to a stream with a single column called raw in string type.

{"key1": "value11", "key2": 12}

First, login in Timeplus Console, in the Streams page, click the New Stream button. Set Stream Name as foo, leaving the Description empty. In the Columns list, type raw as the NAME, type or choose string as the TYPE. Then click Create button.

What we will do is to add new JSON documents in this stream, and later on you can query them via Streaming SQL with easy access to the JSON attributes, e.g.

select raw:key1 as k1, raw:key2::int as k2 from foo

Step 2: Create an API Key

You need to create an API key to access Timeplus REST API. To do so:

  1. Click the user icon on the top-right corner.
  2. Choose Personal Settings
  3. Choose the 2nd tab API Key Management
  4. Click the Create API Key button
  5. Set a readable name and choose an expiration date
  6. Save the API key securely in your computer. You are not going to retrieve the plain text key again in the console.

Step 3: Send data to Timeplus with the API key

Depending on which tool or programming language works best for you, you can send data to Timeplus in different ways.

The base endpoint for the ingestion API is


Make sure you are using the workspace-id, instead of workspace-name. The workspace id is a random string with 8 characters. You can get it from the browser address bar:<workspace-id>/console. The workspace name is a friendly name you set while you create your workspace. Currently this name is readonly but we will make it editable in the future.


curl -s -X POST -H "X-Api-Key: your_api_key" \
-H "Content-Type: text/plain" \ \
-d '
{"key1": "value11", "key2": 12}


const https = require("https");
const options = {
hostname: "",
path: "/ws123456/api/v1beta1/streams/foo/ingest?format=raw",
method: "POST",
headers: {
"Content-Type": "text/plain",
"X-Api-Key": "<your_api_key>",

const data = `{"key1": "value11", "key2": 12}`;
const request = https.request(options, (resp) => {});
request.on("error", (error) => {


import requests

url = ""
headers = {
"X-Api-Key": "your_api_key",
"Content-Type": "text/plain"
data = '''
{"key1": "value11", "key2": 12}

response =, headers=headers, data=data)


You can use built-in libraries or 3rd party libraries to make HTTP requests. In this example, we are using okhttp.

The latest release is available on Maven Central.

import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;


public class Example {
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();

String url = "";
MediaType mediaType = MediaType.parse("text/plain");
String data = """
{"key1": "value11", "key2": 12}
RequestBody body = RequestBody.create(mediaType, data);

Request request = new Request.Builder()
.header("X-Api-Key", "your_api_key")
.header("Content-Type", "text/plain")

try (Response response = client.newCall(request).execute()) {