This is the reference for the gRPC and HTTP APIs that The Things Stack exposes.
Note:The Things Stack API is different from V2 API. If migrating from V2, see here for an overview of changes.
The API examples in this section use the example URL
thethings.example.com, which you will need to replace with the address of your The Things Stack instance. See Server Addresses for a list of URLs for all deployments.
The Things Stack APIs use field masks to specify a subset of fields that should be returned by a reading request, or to specify fields that should be updated in a writing request. See the Field Masks section to learn how they control which fields are returned in API requests.
Fields may be specified in HTTP requests by appending them as query string parameters. For example, to request the
locations of devices in an
EndDeviceRegistry.Get request, add these fields to the
field_mask field. To get this data for device
dev1 in application
curl -i -H "Authorization: Bearer NNSXS.XXXXXXXXX" https://thethings.example.com/api/v3/applications/app1/devices/dev1?field_mask=name,description,locations
Warning:If you are not getting the fields you expect in API responses, see the Field Masks section.
Identifiers specified in the request URL do not need to be specified again in the message body. For example,
GetEndDeviceRequest has an
end_device_ids field and a
field_mask field which are not required in the message body if they are specified in the URL. From the above example:
https://thethings.example.com/api/v3/applications/app1/devices/dev1?field_mask=name,description,locations requests device
dev1 in application
app1 and so no message body is required. These message body fields are only used in gRPC requests.
Note:Fields that are empty or zero are not returned in requests, even if they are specified in a field mask.
Note:If you’re having trouble with the HTTP API, you can always inspect requests in the Console using your browser’s inspector. All of the data displayed in the Console is pulled using HTTP API requests, and this should give you some insight in to how they are formed.
Examples are provided in the Using the API Getting Started section.