Integrating with API
The Sensible Weather API allows you to provide Weather Guarantees to your customers. This document will guide you through the necessary steps to integrate with our API, from authorization to creating, accepting, declining, and cancelling guarantees, as well as updating bookings.
Authorization
Your application must authorize using our authorization API to access the Sensible Weather APIs.
Bearer Token
A bearer token auth header is required in requests to our REST APIs. The token contains authentication data for your app and the set of permissions. To receive a token, send a request using your API keys to our authorization API.
The response from the authorization endpoint contains the expires_in
field which defines the token's expiration in seconds (default expiration is 24 hours). We recommend storing the token in a cache after retrieving it to reduce the number of requests. You can set the expiration time in the cache to be slightly less than the actual token expiration as a buffer.
The API returns a 401: Unauthorized error
when the token expires. A new token is required to complete the API request.
Note: only request a new token when your existing token has expired or is about to expire
Updated 9 months ago