Authentication
All API requests require authentication using an API key:
- To create an API key, go to the API Keys page.
- Then, include the API key in the
Authorization
header of your requests. - You should prefix the API key with
Bearer
.
For example, if your API key is
YzA0ODQwNTAtZTI1NC00MDY1
, you can use it as follows:
const response = await fetch("https://templatedocs.io/api/v1/templates", {
headers: {
"Authorization": "Bearer YzA0ODQwNTAtZTI1NC00MDY1"
}
})
const data = await response.json()
console.log(data)
API Key Scoping and Roles
API keys are scoped to organizations and have roles assigned to them to limit their access:
- Organization Scoping: Each API key belongs to the organization it was created in and can only access resources within that organization
- Role-Based Access: API keys support three roles (Admin, Editor, Member) with different permission levels
- Security: This ensures API keys can only perform actions appropriate to their assigned role
For detailed information about role permissions, see the Organization Roles & Permissions documentation.