Create spans
curl --request POST \
--url https://api.example.com/v1/projects/{project_identifier}/spans \
--header 'Content-Type: application/json' \
--data '
{
"data": [
{
"name": "<string>",
"context": {
"trace_id": "<string>",
"span_id": "<string>"
},
"span_kind": "<string>",
"start_time": "2023-11-07T05:31:56Z",
"end_time": "2023-11-07T05:31:56Z",
"status_code": "<string>",
"id": "",
"parent_id": "<string>",
"status_message": "",
"attributes": {},
"events": [
{
"name": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"attributes": {}
}
]
}
]
}
'import requests
url = "https://api.example.com/v1/projects/{project_identifier}/spans"
payload = { "data": [
{
"name": "<string>",
"context": {
"trace_id": "<string>",
"span_id": "<string>"
},
"span_kind": "<string>",
"start_time": "2023-11-07T05:31:56Z",
"end_time": "2023-11-07T05:31:56Z",
"status_code": "<string>",
"id": "",
"parent_id": "<string>",
"status_message": "",
"attributes": {},
"events": [
{
"name": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"attributes": {}
}
]
}
] }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
data: [
{
name: '<string>',
context: {trace_id: '<string>', span_id: '<string>'},
span_kind: '<string>',
start_time: '2023-11-07T05:31:56Z',
end_time: '2023-11-07T05:31:56Z',
status_code: '<string>',
id: '',
parent_id: '<string>',
status_message: '',
attributes: {},
events: [{name: '<string>', timestamp: '2023-11-07T05:31:56Z', attributes: {}}]
}
]
})
};
fetch('https://api.example.com/v1/projects/{project_identifier}/spans', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/projects/{project_identifier}/spans",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
[
'name' => '<string>',
'context' => [
'trace_id' => '<string>',
'span_id' => '<string>'
],
'span_kind' => '<string>',
'start_time' => '2023-11-07T05:31:56Z',
'end_time' => '2023-11-07T05:31:56Z',
'status_code' => '<string>',
'id' => '',
'parent_id' => '<string>',
'status_message' => '',
'attributes' => [
],
'events' => [
[
'name' => '<string>',
'timestamp' => '2023-11-07T05:31:56Z',
'attributes' => [
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/projects/{project_identifier}/spans"
payload := strings.NewReader("{\n \"data\": [\n {\n \"name\": \"<string>\",\n \"context\": {\n \"trace_id\": \"<string>\",\n \"span_id\": \"<string>\"\n },\n \"span_kind\": \"<string>\",\n \"start_time\": \"2023-11-07T05:31:56Z\",\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"status_code\": \"<string>\",\n \"id\": \"\",\n \"parent_id\": \"<string>\",\n \"status_message\": \"\",\n \"attributes\": {},\n \"events\": [\n {\n \"name\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"attributes\": {}\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/projects/{project_identifier}/spans")
.header("Content-Type", "application/json")
.body("{\n \"data\": [\n {\n \"name\": \"<string>\",\n \"context\": {\n \"trace_id\": \"<string>\",\n \"span_id\": \"<string>\"\n },\n \"span_kind\": \"<string>\",\n \"start_time\": \"2023-11-07T05:31:56Z\",\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"status_code\": \"<string>\",\n \"id\": \"\",\n \"parent_id\": \"<string>\",\n \"status_message\": \"\",\n \"attributes\": {},\n \"events\": [\n {\n \"name\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"attributes\": {}\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/projects/{project_identifier}/spans")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": [\n {\n \"name\": \"<string>\",\n \"context\": {\n \"trace_id\": \"<string>\",\n \"span_id\": \"<string>\"\n },\n \"span_kind\": \"<string>\",\n \"start_time\": \"2023-11-07T05:31:56Z\",\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"status_code\": \"<string>\",\n \"id\": \"\",\n \"parent_id\": \"<string>\",\n \"status_message\": \"\",\n \"attributes\": {},\n \"events\": [\n {\n \"name\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"attributes\": {}\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"total_received": 123,
"total_queued": 123
}"<string>""<string>""<string>"{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Spans
Create spans
Submit spans to be inserted into a project. If any spans are invalid or duplicates, no spans will be inserted.
POST
/
v1
/
projects
/
{project_identifier}
/
spans
Create spans
curl --request POST \
--url https://api.example.com/v1/projects/{project_identifier}/spans \
--header 'Content-Type: application/json' \
--data '
{
"data": [
{
"name": "<string>",
"context": {
"trace_id": "<string>",
"span_id": "<string>"
},
"span_kind": "<string>",
"start_time": "2023-11-07T05:31:56Z",
"end_time": "2023-11-07T05:31:56Z",
"status_code": "<string>",
"id": "",
"parent_id": "<string>",
"status_message": "",
"attributes": {},
"events": [
{
"name": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"attributes": {}
}
]
}
]
}
'import requests
url = "https://api.example.com/v1/projects/{project_identifier}/spans"
payload = { "data": [
{
"name": "<string>",
"context": {
"trace_id": "<string>",
"span_id": "<string>"
},
"span_kind": "<string>",
"start_time": "2023-11-07T05:31:56Z",
"end_time": "2023-11-07T05:31:56Z",
"status_code": "<string>",
"id": "",
"parent_id": "<string>",
"status_message": "",
"attributes": {},
"events": [
{
"name": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"attributes": {}
}
]
}
] }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
data: [
{
name: '<string>',
context: {trace_id: '<string>', span_id: '<string>'},
span_kind: '<string>',
start_time: '2023-11-07T05:31:56Z',
end_time: '2023-11-07T05:31:56Z',
status_code: '<string>',
id: '',
parent_id: '<string>',
status_message: '',
attributes: {},
events: [{name: '<string>', timestamp: '2023-11-07T05:31:56Z', attributes: {}}]
}
]
})
};
fetch('https://api.example.com/v1/projects/{project_identifier}/spans', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/projects/{project_identifier}/spans",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
[
'name' => '<string>',
'context' => [
'trace_id' => '<string>',
'span_id' => '<string>'
],
'span_kind' => '<string>',
'start_time' => '2023-11-07T05:31:56Z',
'end_time' => '2023-11-07T05:31:56Z',
'status_code' => '<string>',
'id' => '',
'parent_id' => '<string>',
'status_message' => '',
'attributes' => [
],
'events' => [
[
'name' => '<string>',
'timestamp' => '2023-11-07T05:31:56Z',
'attributes' => [
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/projects/{project_identifier}/spans"
payload := strings.NewReader("{\n \"data\": [\n {\n \"name\": \"<string>\",\n \"context\": {\n \"trace_id\": \"<string>\",\n \"span_id\": \"<string>\"\n },\n \"span_kind\": \"<string>\",\n \"start_time\": \"2023-11-07T05:31:56Z\",\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"status_code\": \"<string>\",\n \"id\": \"\",\n \"parent_id\": \"<string>\",\n \"status_message\": \"\",\n \"attributes\": {},\n \"events\": [\n {\n \"name\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"attributes\": {}\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/projects/{project_identifier}/spans")
.header("Content-Type", "application/json")
.body("{\n \"data\": [\n {\n \"name\": \"<string>\",\n \"context\": {\n \"trace_id\": \"<string>\",\n \"span_id\": \"<string>\"\n },\n \"span_kind\": \"<string>\",\n \"start_time\": \"2023-11-07T05:31:56Z\",\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"status_code\": \"<string>\",\n \"id\": \"\",\n \"parent_id\": \"<string>\",\n \"status_message\": \"\",\n \"attributes\": {},\n \"events\": [\n {\n \"name\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"attributes\": {}\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/projects/{project_identifier}/spans")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": [\n {\n \"name\": \"<string>\",\n \"context\": {\n \"trace_id\": \"<string>\",\n \"span_id\": \"<string>\"\n },\n \"span_kind\": \"<string>\",\n \"start_time\": \"2023-11-07T05:31:56Z\",\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"status_code\": \"<string>\",\n \"id\": \"\",\n \"parent_id\": \"<string>\",\n \"status_message\": \"\",\n \"attributes\": {},\n \"events\": [\n {\n \"name\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"attributes\": {}\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"total_received": 123,
"total_queued": 123
}"<string>""<string>""<string>"{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Path Parameters
The project identifier: either project ID or project name. If using a project name, it cannot contain slash (/), question mark (?), or pound sign (#) characters.
Body
application/json
Show child attributes
Show child attributes
Was this page helpful?
⌘I

