Sample Search Request & Response

Below is a sample URL with the appropriate authorization code and body.

📘

Multi-Language Sample Support

Here at Datastreamer, we give sample code in several development languages to support most developers. Every sample below sends the same request. The API References endpoints have more than 20 programming languages.

curl --location --request POST 'https://api.platform.datastreamer.io/api/search' \
--header 'Content-Type: application/json' \
--header 'apikey: YOUR_API_KEY' \
--data-raw '{
  "query": {
    "from": 0,
    "size": 10,
    "query": "New York",
    "data_sources": [
      "twitter_auto"
    ]
  }
}'
var client = new RestClient("https://api.platform.datastreamer.io/api/search");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("apikey", "YOUR_API_KEY");
var body = @"{" + "\n" +
@"  ""query"": {" + "\n" +
@"    ""from"": 0," + "\n" +
@"    ""size"": 10," + "\n" +
@"    ""query"": ""New York""," + "\n" +
@"    ""data_sources"": [" + "\n" +
@"         ""twitter_auto""" + "\n" +
@"    ]" + "\n" +
@"  }" + "\n" +
@"}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var settings = {
  "url": "https://api.platform.datastreamer.io/api/search",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Content-Type": "application/json",
    "apikey": "YOUR_API_KEY"
  },
  "data": JSON.stringify({
    "query": {
      "from": 0,
      "size": 10,
      "query": "New York",
      "data_sources": [
        "twitter_auto"
      ]
    }
  }),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.platform.datastreamer.io/api/search"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];
NSDictionary *headers = @{
  @"Content-Type": @"application/json",
  @"apikey": @"YOUR_API_KEY"
};

[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n  \"query\": {\n    \"from\": 0,\n    \"size\": 10,\n    \"query\": \"New York\",\n    \"data_sources\": [\n         \"twitter_auto\"\n    ]\n  }\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];

[request setHTTPMethod:@"POST"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.platform.datastreamer.io/api/search',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
  "query": {
    "from": 0,
    "size": 10,
    "query": "New York",
    "data_sources": [
         "twitter_auto"
    ]
  }
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'apikey: YOUR_API_KEY'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("api.platform.datastreamer.io")
payload = json.dumps({
  "query": {
    "from": 0,
    "size": 10,
    "query": "New York",
    "data_sources": [
      "twitter_auto"
    ]
  }
})
headers = {
  'Content-Type': 'application/json',
  'apikey': 'YOUR_API_KEY'
}
conn.request("POST", "/api/search", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("apikey", "YOUR_API_KEY")

$body = "{`n  `"query`": {`n    `"from`": 0,`n    `"size`": 10,`n    `"query`": `"New York`",`n    `"data_sources`": [`n         `"twitter_auto`"`n    ]`n  }`n}"

$response = Invoke-RestMethod 'https://api.platform.datastreamer.io/api/search' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json

This request is responded to by a 200 Response Code with JSON like the following, shortened here to one result:

For indexed storage, add "track_total_hits": true inside query to request total; with false, the response omits it. The relation value gte below means the count is a lower bound.

{
    "results": [
        {
            "id": "1802345678901234567-twitter_auto",
            "doc_date": "2026-06-15T18:22:10Z",
            "data_source": "twitter_auto",
            "source": {
                "link": "https://x.com/example_user/status/1802345678901234567"
            },
            "content": {
                "body": "Heading to New York for the weekend.",
                "published": "2026-06-15T18:22:10Z"
            },
            "author": {
                "name": "Example User",
                "handle": "example_user"
            },
            "enrichment": {
                "language": "en",
                "sentiment": "neutral"
            }
        }
    ],
    "total": {
        "value": 10000,
        "relation": "gte"
    },
    "search_after": [
        1781547730000
    ]
}

Did this page help you?