Skip to content

API

Sharelyne API and webhooks

A REST API to read and create posts, ideas and analytics, and webhooks to know when a post is sent. Available on Essentials and above.
On this page

Authentication

Create a key in Settings, API. Keys start with shl_. Send it in the Authorization header. A key acts as its owner, in one workspace.

curl https://sharelyne.slimbennasrallah.com/api/v1/me \
  -H "Authorization: Bearer shl_your_key"

Keep keys secret

A key can publish posts. Never put it in a web page or an app. Revoke it in Settings if it leaks.

Endpoints

All paths start with https://sharelyne.com. Bodies and answers are JSON.

MethodPathWhat it does
GET/api/v1/meThe key owner and the workspace.
GET/api/v1/channelsConnected channels and their posting times.
GET/api/v1/postsList posts. Filter with status, channel, from, to, take and skip.
GET/api/v1/posts/:idOne post.
POST/api/v1/postsCreate a post: one version per channel, and an action.
DELETE/api/v1/posts/:idDelete a post that is not published yet.
GET/api/v1/ideasAll ideas.
POST/api/v1/ideasAdd an idea with title, text and groupId.
GET/api/v1/analyticsThe numbers of a period. Use days and channel.
POST/api/v1/opsRun any operation the app uses, with an op name and its args.

Examples

List scheduled posts

curl "https://sharelyne.slimbennasrallah.com/api/v1/posts?status=scheduled,queued&take=20" \
  -H "Authorization: Bearer shl_your_key"

Create a post on two channels

Each version targets one channel. action is one of draft, queue, schedule, now or approval.

curl -X POST https://sharelyne.slimbennasrallah.com/api/v1/posts \
  -H "Authorization: Bearer shl_your_key" \
  -H "content-type: application/json" \
  -d '{
    "action": "queue",
    "versions": [
      { "channelId": "CHANNEL_ID_LINKEDIN", "text": "Our spring menu starts Thursday." },
      { "channelId": "CHANNEL_ID_X", "text": "Spring menu, Thursday.", "firstComment": "Book a table: https://example.com" }
    ]
  }'

Schedule at an exact time

{ "action": "schedule", "scheduledAt": "2026-12-03T09:30:00+01:00", "versions": [ … ] }

queue uses the next free posting time. schedule needs scheduledAt in ISO 8601 with an offset. approval needs a plan with approvals.

Read the numbers of the last 30 days

curl "https://sharelyne.slimbennasrallah.com/api/v1/analytics?days=30" \
  -H "Authorization: Bearer shl_your_key"

Responses and errors

A good answer is { "data": … }. An error is { "error": "message" } with an HTTP status.

StatusMeaning
400The request is not valid. The message tells which field.
401The key is missing, wrong or revoked.
402Your plan does not include this. The API needs Essentials or above.
403The key owner cannot do this, for example a viewer who tries to write.
404Nothing at this path or id.
429Too many requests.

The limit is 600 requests per minute for each key owner.

Webhooks

Add a webhook URL in Settings, API. Sharelyne sends a POST with a JSON body when something happens. Leave the events empty to receive all of them.

EventSent when
post.sentA post was published on its network.
post.failedA post failed to publish. The payload has the error.

The body looks like { "event", "data", "sentAt" }. Each delivery has these headers.

HeaderValue
sharelyne-eventThe event name.
sharelyne-deliveryA unique delivery id.
sharelyne-signatureHMAC SHA-256 of the raw body, as hex, with your webhook secret.

Check the signature before you trust a delivery.

import { createHmac, timingSafeEqual } from "node:crypto";

const expected = createHmac("sha256", process.env.SHARELYNE_WEBHOOK_SECRET)
  .update(rawBody)
  .digest("hex");
const ok = timingSafeEqual(Buffer.from(expected), Buffer.from(req.headers["sharelyne-signature"]));

Answer with a 2xx status within 10 seconds. Sharelyne records each delivery and its status.