Create signals in bulk
curl --request POST \
--url https://app.gaintrace.com/api/v1/signals/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": [
{
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"description": "<string>",
"metadata": {}
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: [
{
accountId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
title: '<string>',
description: '<string>',
metadata: {}
}
]
})
};
fetch('https://app.gaintrace.com/api/v1/signals/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.gaintrace.com/api/v1/signals/batch"
payload = { "data": [
{
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"description": "<string>",
"metadata": {}
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": [
{
"index": 123,
"status": "created",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error": "<string>"
}
],
"meta": {
"received": 123,
"succeeded": 123,
"failed": 123
}
}{
"error": {
"code": "bad_request",
"message": "Invalid JSON body",
"doc_url": "https://docs.gaintrace.com/errors#bad_request"
}
}{
"error": {
"code": "unauthorized",
"message": "Missing Authorization header",
"doc_url": "https://docs.gaintrace.com/errors#unauthorized"
}
}{
"error": {
"code": "forbidden",
"message": "Insufficient scope: write:companies required",
"doc_url": "https://docs.gaintrace.com/errors#forbidden"
}
}{
"error": {
"code": "unprocessable_entity",
"message": "Request validation failed. name: name is required",
"doc_url": "https://docs.gaintrace.com/errors#unprocessable_entity"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Can't accept more than 60 requests a minute from one API key. Retry in 23 seconds.",
"doc_url": "https://docs.gaintrace.com/errors#rate_limit_exceeded"
}
}{
"error": {
"code": "internal_server_error",
"message": "Something went wrong. Try again in a moment.",
"doc_url": "https://docs.gaintrace.com/errors#internal_server_error"
}
}{
"error": {
"code": "service_unavailable",
"message": "We had trouble reaching the database. Try again in a moment.",
"doc_url": "https://docs.gaintrace.com/errors#service_unavailable"
}
}{
"error": {
"code": "gateway_timeout",
"message": "The request timed out. Try again in a moment.",
"doc_url": "https://docs.gaintrace.com/errors#gateway_timeout"
}
}Signals
Create signals in bulk
Create up to 1000 signals. Partial success: each item reports its own outcome, and one bad item never fails the batch. Each item’s accountId takes a Company id or the legacy account id. An id GainTrace can’t find fails that item with a message that starts Couldn't find the Company. Each created signal fires signal.created with source set to api. Batches of more than 25 signals are delivered in paced batches instead of right away.
Scope: write:signals
POST
/
signals
/
batch
Create signals in bulk
curl --request POST \
--url https://app.gaintrace.com/api/v1/signals/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": [
{
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"description": "<string>",
"metadata": {}
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: [
{
accountId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
title: '<string>',
description: '<string>',
metadata: {}
}
]
})
};
fetch('https://app.gaintrace.com/api/v1/signals/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.gaintrace.com/api/v1/signals/batch"
payload = { "data": [
{
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"description": "<string>",
"metadata": {}
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": [
{
"index": 123,
"status": "created",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error": "<string>"
}
],
"meta": {
"received": 123,
"succeeded": 123,
"failed": 123
}
}{
"error": {
"code": "bad_request",
"message": "Invalid JSON body",
"doc_url": "https://docs.gaintrace.com/errors#bad_request"
}
}{
"error": {
"code": "unauthorized",
"message": "Missing Authorization header",
"doc_url": "https://docs.gaintrace.com/errors#unauthorized"
}
}{
"error": {
"code": "forbidden",
"message": "Insufficient scope: write:companies required",
"doc_url": "https://docs.gaintrace.com/errors#forbidden"
}
}{
"error": {
"code": "unprocessable_entity",
"message": "Request validation failed. name: name is required",
"doc_url": "https://docs.gaintrace.com/errors#unprocessable_entity"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Can't accept more than 60 requests a minute from one API key. Retry in 23 seconds.",
"doc_url": "https://docs.gaintrace.com/errors#rate_limit_exceeded"
}
}{
"error": {
"code": "internal_server_error",
"message": "Something went wrong. Try again in a moment.",
"doc_url": "https://docs.gaintrace.com/errors#internal_server_error"
}
}{
"error": {
"code": "service_unavailable",
"message": "We had trouble reaching the database. Try again in a moment.",
"doc_url": "https://docs.gaintrace.com/errors#service_unavailable"
}
}{
"error": {
"code": "gateway_timeout",
"message": "The request timed out. Try again in a moment.",
"doc_url": "https://docs.gaintrace.com/errors#gateway_timeout"
}
}Authorizations
Body
application/json
Was this page helpful?