API Reference

TinyCM content is served via an API. This reference describes endpoints and parameters for interacting with your content.

We recommend you use the official typescript TinyCM Client to integrate TinyCM.

Official TinyCM Client

import { createClient } from "tinycm-client";

const tinycmClient = createClient({
  apiKey: "TINYCM_API_KEY", // Create an api key in the TinyCM Dashboard.
  projectId: "TINYCM_PROJECT_ID", // Find your project id in the TinyCM Dashboard
  version: "v1", // Current TinyCM API Version
});

const posts = await tinycmClient.posts.getAll();
const post = await tinycmClient.posts.getBySlug("post-slug");

If for any other reasons you need a different implementation, see the API Reference below.

Authentication

TinyCM uses a combination of API Keys and Project IDs to authenticate requests. You can manage your API Keys from the TinyCM Dashboard

  • x-api-key : API Key associated with the project you want to fetch data from

  • x-project-id : Project ID of the project your want to fetch data from

Example Request:

This example request will list all published posts for a project. Replace x-api-key and x-project-uid with your own API Key and Project ID.

curl  -X GET \
  'https://www.tinycm.com/api/v1/content/posts' \
  --header 'x-api-key: <your_api_key>' \
  --header 'x-project-id: <your_project_id>'

Posts

GET https://www.tinycm.com/api/v1/content/posts
GET https://www.tinycm.com/api/v1/content/posts/:slug
GET https://www.tinycm.com/api/v1/content/posts/slugs
GET https://www.tinycm.com/api/v1/content/posts/authors/:author-slug
GET https://www.tinycm.com/api/v1/content/posts/tags/:tag-slug

List all posts

Returns a lists of all your project’s posts. The posts are returned sorted by published date, with the most recent posts first.

https://www.tinycm.com/api/content/posts

Query Parameters (optional):

  • limit : number

    • Defaults to limit=1

  • page : number

    • Defaults to page=1

Retrieve Post

Retrieves a post by slug path.

https://www.tinycm.com/api/content/posts/:slug

List all slugs

Returns a lists of all your project’s post slugs. The slugs are returned sorted by published date, with the oldest first.

https://www.tinycm.com/api/content/posts/slugs

Lists posts by author

Returns a lists of all your project’s posts by a specific author. The posts are returned sorted by published date, with the most recent posts first.

https://www.tinycm.com/api/content/authors/:author-slug

Lists posts by tag

Returns a lists of all your project’s posts by a specific tag. The posts are returned sorted by published date, with the most recent posts first.

https://www.tinycm.com/api/content/tags/:tag-slug

Tags

GET https://www.tinycm.com/api/content/tags

List all tags

Returns a lists of all your project’s tags. The tags are returned sorted by name.

https://www.tinycm.com/api/content/tags

Lists posts by tag

Returns a lists of all your project’s posts by a specific tag. The posts are returned sorted by published date, with the most recent posts first.

https://www.tinycm.com/api/content/tags/:slug

Authors

GET https://www.tinycm.com/api/content/authors
GET https://www.tinycm.com/api/content/authors/:slug

List all authors

Returns a lists of all your project’s authors. The authors are returned sorted by name.

https://www.tinycm.com/api/content/authors