Getting Started Devices Gateways The Things Stack Integrations Reference
Get The Things Stack

Reference

    Overview
  • Adaptive Data Rate
  • API
    • Authentication
    • Fields and Field Masks
    • Application APIs
    • Application Package APIs
    • Application Pub/Sub APIs
    • Application Server APIs
    • Application Webhook APIs
    • Client APIs
    • End Device APIs
    • Events API
    • Gateway APIs
    • Gateway Server APIs
    • Gateway Server MQTT
    • Network Operations Center APIs
    • Network Server APIs
    • Organization APIs
    • Storage Integration API
    • Tenant APIs
    • User APIs
  • Application Packages
  • Billing with Stripe
  • Command-Line Interface
  • Components
  • Configuration
  • Data Retention and Privacy
  • Device Claiming Configuration
  • Email Templates
  • Federated Authentication
  • Frequency Plans
  • FUOTA
  • Gateway RTT
  • Glossary
  • ID and EUI Constraints
  • Last Activity
  • LoRa Basics Station Implementation Guide
  • LoRaWAN Join Server Configuration
  • Packet Broker Routing
  • Packet Forwarders
  • Rate Limiting
  • Resource Limiting
  • Root Certificates
  • Telemetry
  • The Things Network

API

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.

HTTP Queries

Field Masks

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 name, description, and 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 app1:

curl -i -H "Authorization: Bearer NNSXS.XXXXXXXXX" https://thethings.example.com/api/v3/applications/app1/devices/dev1?field_mask=name,description,locations

The thethings.example.com URL needs to be replaced with the address of your The Things Stack instance. See Server Addresses for a list of URLs for all deployments.

Optional Fields

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.

If you are 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 and Troubleshooting

Examples, fixes for common errors and answers to FAQ are provided in the Using the API Getting Started section.

← Adaptive Data Rate Authentication →

On this page

  • HTTP Queries
  • Examples and Troubleshooting

The Things Stack

Getting Started

Devices

Gateways

The Things Stack

Integrations

Reference

Contributing

GitHub

About Us

The Things Industries