Library: API Documentation

There are a couple of API endpoints you can use to manage your library outside of Reading Supply. Our documentation examples are written for NodeJS applications, but the API should work regardless of language/framework.

  • Accepts application/json for requests and responses.

  • No libraries necessary, just use fetch on the client or server.

  • Examples use async/await. If you are not using a version of JavaScript that supports async/await you will have to use callbacks.





GET /api/v1/library

const key = `YOUR-API-KEY`;
const response = await fetch('https://reading.supply/api/v1/library', { method: 'GET', headers: { 'Content-Type': 'application/json', Authorization: `Basic ${key}`, }, }); const json = await response.json();



On success

{  posts: {    'post-id': {      "id": "post-id",
      "title": "This is a title",
      "description": "This is a description",
      "content": "Hello World",
      "slug": null,
      "data": null,
      "permissions": null,
      "countSaves": 0,
      "publishedAt": null,
      "engagedAt": "2019-09-22T20:05:55.222Z",
      "createdAt": "2019-09-22T20:05:55.222Z",
      "updatedAt": "2019-09-22T20:05:55.222Z",
      "countViews": 0,
      "countReads": 0    }  }}



On failure

{  error: 'GET /api/v1/library'}





POST /api/v1/library

const key = `YOUR-API-KEY`;
const response = await fetch('https://reading.supply/api/v1/library', { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: `Basic ${key}`, }, body: JSON.stringify({ title: 'This is a title', description: 'This is a description', content: 'Hello World', public: true }), }); const json = await response.json();



On success

{  post: {    "id": "new-post-id",
    "url": "https://reading.supply/post/new-post-id"  }}



On failure

{  error: 'POST /api/v1/library'}





DELETE /api/v1/library

const key = `YOUR-API-KEY`;const postId = 'id-of-post-to-delete';
const response = await fetch('https://reading.supply/api/v1/library', { method: 'DELETE', headers: { 'Content-Type': 'application/json', Authorization: `Basic ${key}`, }, body: JSON.stringify({ id: postId, }), }); const json = await response.json();



On success

{}



On failure

{  error: 'DELETE /api/v1/library'}

Note: Deleting your draft is irreversible.

API Requests

If you are a user of this API, ping us on Telegram or Twitter if you have any specific needs.

To reply you need to sign in.