Sources API

Manage your sources using a simple HTTP API.

get
Listing all existing sources

https://logtail.com/api/v1/sources
Returns a list of your team's sources.
Request
Response
Request
Headers
Authentication
required
string
Bearer YOUR_API_TOKEN
Query Parameters
page
optional
number
Page number
per_page
optional
number
The number of sources per page (max 50)
Response
200: OK
{
"data": [
{
"id": "95",
"type": "source",
"attributes": {
"team_id": 123,
"name": "Real-Time Flights",
"table_name": "real_time_flights",
"platform": "flights",
"token": "FczKcxEhjEDE58dBX7XaeX1q",
"retention": 14,
"ingesting_paused": false,
"autogenerate_views": false,
"created_at": "2021-05-27T12:30:41.695Z",
"updated_at": "2021-06-11T14:00:50.756Z",
}
}
],
"pagination": {
"first": "https://www.logtail.com/api/v1/sources?page=1&per_page=10",
"last": "https://www.logtail.com/api/v1/sources?page=12&per_page=10",
"prev": "https://www.logtail.com/api/v1/sources?page=11&per_page=10",
"next": "https://www.logtail.com/api/v1/sources?page=12&per_page=10"
}
}
Example cURL
Example cURL
curl --request GET \
--url https://www.logtail.com/api/v1/sources \
--header 'Authorization: Bearer YOUR_API_TOKEN'

get
Getting a single source

https://logtail.com/api/v1/sources/:id
Get a single source by its ID.
Request
Response
Request
Path Parameters
id
required
number
Source ID
Response
200: OK
{
"id": "95",
"type": "source",
"attributes": {
"team_id": 123,
"name": "Real-Time Flights",
"table_name": "real_time_flights",
"platform": "flights",
"token": "FczKcxEhjEDE58dBX7XaeX1q",
"retention": 14,
"ingesting_paused": false,
"autogenerate_views": false,
"created_at": "2021-05-27T12:30:41.695Z",
"updated_at": "2021-06-11T14:00:50.756Z",
}
}
404: Not Found
Your team doesn't have a source with this ID.
{
"errors": "Resource with provided ID was not found"
}
Example cURL
Example cURL
curl --request GET \
--url https://www.logtail.com/api/v1/sources/123 \
--header 'Authorization: Bearer YOUR_API_TOKEN'

post
Creating a source

https://logtail.com/api/v1/sources
Request
Response
Request
Form Data Parameters
name
required
string
Source name
platform
required
string
Source platform. The currently supported platforms are: - kubernetes - docker - ruby - python - javascript - node - logstash - fluentbit - fluentd - rsyslog - syslog-ng - http - vector - heroku - ubuntu - apache2 - nginx - postgresql - mysql - mongodb - redis - cloudflare_worker - dokku
Response
200: OK
The source was created.
{
"id": "95",
"type": "source",
"attributes": {
"team_id": 123,
"name": "Nginx",
"table_name": "nginx",
"platform": "nginx",
"token": "FczKcxEhjEDE58dBX7XaeX1q",
"created_at": "2021-05-27T12:30:41.695Z",
"updated_at": "2021-06-11T14:00:50.756Z",
"resource_group_id": 0,
"position": 0,
"retention": 14,
"receiving_logs": false,
"columns": [],
"columns_quota": 300,
"ingesting_paused": false,
"autogenerate_views": false,
"livetail_primary_fields": [
"level_string",
"nginx.status_integer",
"nginx.method_string",
"nginx.host_string",
"nginx.path_string",
"nginx.client_string",
"nginx.agent_string",
"message_string"
],
"grafana_primary_fields": [
"level_string",
"nginx.status_integer",
"nginx.method_string",
"nginx.host_string",
"nginx.path_string",
"nginx.client_string",
"nginx.agent_string",
"message_string"
]
}
}
422: Unprocessable Entity
Validation failed.

patch
Updating an existing source

https://logtail.com/api/v1/sources/:id
Request
Response
Request
Path Parameters
id
required
number
Source ID
Form Data Parameters
ingesting_paused
optional
boolean
Enable or disable ingesting for this source
name
optional
string
Source name
autogenerate_views
optional
boolean
Should Logtail automatically generate Views for this source? This field is currently only applicable to the ubuntu platform
Response
200: OK
The source was updated.
{
"id": "95",
"type": "source",
"attributes": {
"team_id": 123,
"name": "Nginx",
"table_name": "nginx",
"platform": "nginx",
"token": "FczKcxEhjEDE58dBX7XaeX1q",
"retention": 14,
"ingesting_paused": false,
"autogenerate_views": false,
"created_at": "2021-05-27T12:30:41.695Z",
"updated_at": "2021-06-11T14:00:50.756Z",
}
}
404: Not Found
Your team has no source with the given ID.
{
"errors": "Resource with provided ID was not found"
}
422: Unprocessable Entity
Validation failed.
{
"errors": "Failed to update the source."
}

delete
Deleting an existing source

https://logtail.com/api/v1/sources/:id
Request
Response
Request
Path Parameters
id
required
number
Source ID
Response
204: No Content
The source was deleted.
404: Not Found
Your team has no source with the given ID.
{
"errors": "Resource with provided ID was not found"
}