Knowledge Base
Introduction to the Narrative API
Introduction to the Narrative Data Collaboration Platform API
The Narrative API is a RESTful API designed to enable seamless data collaboration. This document provides an introduction to the Narrative API, outlining authentication methods, documentation resources, and best practices for using the API.
Overview
- RESTful Architecture
Narrative’s API is organized around REST principles. It features:- Predictable, resource-oriented URLs
- JSON-encoded responses
- Standard HTTP response codes and methods (verbs)
- Form-encoded request bodies
- Base URL
The production base URL for the API is:https://api.narrative.io
- Learn More
To learn more about the Narrative Data Collaboration Platform in general, please see the Platform Knowledge Base: https://kb.narrative.io/.
API Service Documentation
You can find the complete, detailed OpenAPI documentation (for the latest versions of all services) here:
Authentication
Bearer Authentication
The Narrative API uses bearer tokens for authentication.
- You can create tokens with granular read/write permissions that align with the specific API services you intend to use.
- Tokens should be kept secure and never exposed in public repositories or client-side code.
Authentication Requirements
With a few exceptions, only users and applications authorized by Bearer Auth tokens may make API calls to the Narrative API.
Creating a Token
You can create a token using the Narrative Platform UI. Read more here NEEDS LINK
Example: Using cURL with Environment Variables
export DATASET_ID=12345
export TOKEN="YOUR_BEARER_TOKEN"
curl -vvv --request GET \
--url https://api.narrative.io/datasets/${DATASET_ID} \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json"
In this example, two environment variables (DATASET_ID
and TOKEN
) are used to keep sensitive information out of the command
Best Practices
- Rate Limits
- Narrative does not currently enforce customer-facing API limits, but reserves the right to add them in the future. Please avoid calling the API from multiple services simultaneously, or attempting to call the API directly from client-side code.
- Avoid Excessive or Distributed Direct Calls
- Please avoid calling the API from multiple services simultaneously or in a distributed manner, and do not call the API directly from client-side code. Instead:
- Use an API proxy layer to consolidate and manage requests.
- Implement a caching mechanism to reduce redundant calls.
- Include retry logic in case you approach or exceed any future rate limits.
- Granular Permissions
- When creating bearer tokens, limit permissions to the minimum required for your use case. This follows the principle of least privilege and helps keep your data secure.
- Versioning
- Pay attention to API version information in the OpenAPI docs. Backwards-incompatible changes (if any) are typically communicated in advance (see Breaking Changes).
Breaking Changes
As our API is in Open Beta, Narrative reserves the right to make updates to the API when necessary, including Breaking Changes. However, we will make every effort to adhere to the following standards:
- API Versioning
- Any breaking changes will be introduced as a new, versioned endpoint (e.g.,
/v2/
or/v2.1/
). - To avoid being impacted by a breaking change, you should version your API calls where versions are implemented in the documentation.
- Any breaking changes will be introduced as a new, versioned endpoint (e.g.,
- Advance Notice
- We will make a best effort to provide 30 days’ notice of any breaking change, giving you time to adjust your integrations as needed.
Support and Resources
- Support
- If you encounter issues or wish to request features, email: support@narrative.io
- Security
- For the latest security information and best practices, refer to: https://www.narrative.io/security
- Legal
- By using the Narrative API, you agree to our Terms of Service (TOS). Please review the full terms here: https://www.narrative.io/legal/terms-of-service