API
Sharelyne API and webhooks
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
Endpoints
All paths start with https://sharelyne.com. Bodies and answers are JSON.
| Method | Path | What it does |
|---|---|---|
| GET | /api/v1/me | The key owner and the workspace. |
| GET | /api/v1/channels | Connected channels and their posting times. |
| GET | /api/v1/posts | List posts. Filter with status, channel, from, to, take and skip. |
| GET | /api/v1/posts/:id | One post. |
| POST | /api/v1/posts | Create a post: one version per channel, and an action. |
| DELETE | /api/v1/posts/:id | Delete a post that is not published yet. |
| GET | /api/v1/ideas | All ideas. |
| POST | /api/v1/ideas | Add an idea with title, text and groupId. |
| GET | /api/v1/analytics | The numbers of a period. Use days and channel. |
| POST | /api/v1/ops | Run 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.
| Status | Meaning |
|---|---|
400 | The request is not valid. The message tells which field. |
401 | The key is missing, wrong or revoked. |
402 | Your plan does not include this. The API needs Essentials or above. |
403 | The key owner cannot do this, for example a viewer who tries to write. |
404 | Nothing at this path or id. |
429 | Too 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.
| Event | Sent when |
|---|---|
post.sent | A post was published on its network. |
post.failed | A post failed to publish. The payload has the error. |
The body looks like { "event", "data", "sentAt" }. Each delivery has these headers.
| Header | Value |
|---|---|
sharelyne-event | The event name. |
sharelyne-delivery | A unique delivery id. |
sharelyne-signature | HMAC 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.