Influence

Influence API

A plain JSON API for pages, files, spaces and search. Everything here is what the app itself uses.

Getting started

Everything the app does goes through this API. Make a token under Workspace. It acts as you, with exactly your permissions, so it can't read a page you can't.

export INF="https://harrowsoft.com/influence/api"
export TOKEN="your token"

curl -H "Authorization: Bearer $TOKEN" "$INF/search?q=deploy"

Send and receive JSON. Times are milliseconds since 1970, in UTC. When something goes wrong you get a status code and {"error": "A sentence you can show someone"}. A token can make 1,200 requests a minute. Past that you get a 429, and waiting a moment is enough.

Pages

The easiest way to write a page from a script is in Markdown.

curl -X POST "$INF/pages" -H "Authorization: Bearer $TOKEN" -H "content-type: application/json" \
  -d '{"space": "ENG", "title": "How we deploy", "markdown": "## Before you start\n\n- Tests are green\n- Someone read the diff"}'
POST /pagesMake a page: space, and optionally title, parent, markdown, template, kind (page or board).
GET /page/{id}One page with its words, comments, files, labels and versions so far.
GET /page/{id}/briefA short look at one page: where it lives, how fresh it is, and how it starts.
POST /page/{id}/schedulePublish a draft by itself at a moment you pick (at, milliseconds since 1970, within a year), or send null to keep it a plain draft.
GET /page/{id}/bodyJust the title and the words.
PATCH /page/{id}Change title, owner, labels or wide.
DELETE /page/{id}Moves it to the trash.
POST /page/{id}/restoreBrings it back.
POST /page/{id}/moveMove it: parent, and optionally before.
POST /page/{id}/copyA copy of it, with its files.
GET /page/{id}/export/{kind}Download it: md, html or doc.
GET /page/{id}/versionsEvery saved version.
GET /page/{id}/version/{num}One old version.
POST /page/{id}/verifySay it's still right, for a while.
POST /page/{id}/commentsAdd a comment: body.
PATCH /comment/{id}Change your comment: body.
DELETE /comment/{id}Delete your comment.
POST /comment/{id}/resolveMark it done.
POST /page/{id}/watchFollow it, or stop following it.

Files

curl -X POST "$INF/page/123/files" -H "Authorization: Bearer $TOKEN" -H "x-filename: plan.pdf" \
  -H "x-new-version: 1" -H "content-type: application/pdf" --data-binary @plan.pdf
POST /page/{id}/filesUpload a file as the raw body, with its name in x-filename. Up to 50 MB. With x-new-version: 1, a file of the same name gets a new version instead of a twin.
GET /file/{id}Download the current version.
DELETE /file/{id}Delete it and its versions.
GET /file/{id}/versionsIts earlier versions.
GET /file/{id}/version/{v}Download an earlier version.
POST /file/{id}/version/{v}/restoreMake an earlier version current.
curl -G "$INF/search" -H "Authorization: Bearer $TOKEN" --data-urlencode "q=how do we deploy" -d space=ENG -d trust=verified
GET /searchq, and optionally space, by (a person's id), trust (verified), label, limit. Typos still find it, and verified pages come first.
GET /labelsEvery label in use.

Spaces

GET /bootYou, your workspace, its people and the spaces you can see.
POST /spacesMake a space: name, and optionally key, description, private.
GET /space/{key}A space with its page tree.
PATCH /space/{key}Change name or description.
DELETE /space/{key}Delete it and everything in it. Admins only.
GET /space/{key}/healthWhat's overdue for review, unowned or linking to nothing.
GET /space/{key}/trashPages in its trash.
GET /templatesThe templates you can start from.

People and everything else

POST /invitesAn invite link: role (admin, member, viewer).
PATCH /member/{id}Change role, or active to remove or bring someone back.
PUT /account/prefsYour own settings. language is es, fr, de, or empty for English.
PUT /account/photoYour picture, as the raw body: a JPEG or PNG under 512 KB, no side over 1,024 pixels.
PATCH /account/aboutThe few words beside your name: title, department and place, 80 characters each.
GET /push/keyThe server's public key for Web Push, for pushManager.subscribe.
POST /push/subscribeTurn notifications on for one device: its subscription, as PushSubscription.toJSON() gives it. Only the browsers' own push services are accepted.
POST /push/unsubscribeTurn them off for one device: endpoint.
POST /push/testSend a test notification to each of your devices.
GET /push/prefsWhat buzzes your devices: off (kinds turned off), quiet (from and to in minutes of your day, and your clock's offset from UTC), and the kinds there are.
PUT /push/prefsChange them: off and quiet (or null for none).
DELETE /account/photoTake your picture away, so your initials show again.
GET /photo/{member}Someone's picture, if you can see them. Add ?v= with their photo number from the people list, and it can be kept for good.
GET /notificationsWhat's aimed at you.
GET /auditWho did what. Admins only.
GET /exportEvery page, comment and file as one zip. Admins only.

Scripts written for Confluence

Anything written for Confluence keeps working. Point it at https://harrowsoft.com/influence/wiki and sign in with your email and a token. Our tests run the real atlassian-python-api client, for both Server and Cloud.

GET /rest/api/contentThe classic API: content, search, spaces, labels, history, children and comments.
GET /api/v2/pagesList pages. Filter with space-id, title, status.
POST /api/v2/pagesMake a page: spaceId, title, body, and optionally parentId.
GET /api/v2/pages/{id}One page. Add body-format=storage for its words.
PUT /api/v2/pages/{id}Change a page. Send the next version.number.
GET /api/v2/pages/{id}/direct-childrenThe pages under it.
GET /api/v2/pages/{id}/versionsIts versions.
GET /api/v2/pages/{id}/labelsIts labels.
GET /api/v2/pages/{id}/footer-commentsIts comments.
GET /api/v2/blogpostsList blog posts.
GET /api/v2/spacesList spaces. Filter with keys.
GET /api/v2/spaces/{id}/pagesThe pages in a space.

Automation

A rule starts from something that happens, on a schedule, from a button on a page, or from another system. In its words, {{page.title}}, {{page.url}}, {{page.space}}, {{page.owner}}, {{actor}} and {{now}} fill themselves in.

GET /rulesRules. Add ?space=ENG for one space's. Admins only.
POST /rulesMake one: name, trigger, config with if and then, and optionally space. A scheduled rule also has every and cql.
PATCH /rule/{id}Change it, or turn it off with enabled.
DELETE /rule/{id}Delete it.
GET /rule/{id}/logWhat it did lately.
GET /page/{id}/rulesRules someone can run from this page.
POST /page/{id}/rules/{rule}Run one.

Looking after pages

GET /page/{id}/approvalEvery round of approval on a page.
POST /page/{id}/approvalAsk for approval: people, and optionally message and due_at.
POST /page/{id}/approval/answeranswer is approve or changes, with an optional comment.
DELETE /page/{id}/approvalCall it off.
GET /page/{id}/watchersWho's watching.
POST /page/{id}/watchersAdd a member.
POST /page/{id}/reactAdd or take off an emoji.
GET /page/{id}/relatedPages like this one.
POST /page/{id}/ask-accessAsk to see a page. It answers the same whether the page exists or not.
POST /page/{id}/redactReplace text with a solid bar. history does earlier versions too. Admins only.
GET /space/{key}/contentEvery page in a space. Filter with q, owner, idle, kind, status.
POST /space/{key}/contentDo one thing to many pages: ids and action (archive, restore, trash, owner, move, label).
POST /import/documentBring in a file: ?space=ENG, and x-filename saying what it is. Word, HTML, Markdown or a Notion zip.
GET /syncedSynced blocks.
POST /syncedMake one: title and doc.
PUT /synced/{id}Change it everywhere.

Questions

GET /questionsQuestions, newest first. ?q= searches, ?topic= narrows, ?show= takes top, unanswered or mine.
POST /questionstitle, body, topics.
POST /question/{id}/answersbody.
POST /question/{id}/acceptanswer, or null to clear it.
GET /space/{key}/bookEvery page of a space in reading order, as HTML, with its PDF settings.
GET /file/{id}/commentsComments on a file.
POST /file/{id}/commentsbody.

Single sign-on

Set this up under Workspace settings, over OpenID Connect or SAML. These addresses are what your provider needs. {slug} is the short name you choose there.

GET /influence/sso/{slug}Starts a sign-in.
POST /influence/sso/{slug}/acsWhere a SAML provider sends people back. Assertions must be signed, and not encrypted.
GET /influence/sso/{slug}/metadataThis workspace's SAML details, for providers that read metadata.

Monitoring

Off until you set INF_METRICS_TOKEN in the service's environment. Send that token as a bearer token. The numbers are counts and sizes, in Prometheus's text format, and they name nobody.

GET /influence/metricsCounts for a monitoring tool.