Bina dengan s.id — REST API, Webhooks & OAuth
Cipta pautan pendek, jejak klik, dan automatikan aliran kerja anda dengan platform pembangun s.id. Pengesahan kunci API yang mudah, webhook masa nyata, dan OAuth 2.0 untuk aplikasi pihak ketiga.
REST API
Urus pautan, kod QR, dan data pengguna dengan API JSON yang bersih. Pengesahan token Bearer, 38 req/min.
Ketahui Lebih LanjutWebhooks
Langgan link.created, link.clicked, qr.scanned, dan lagi. Muatan bertanda tangan HMAC.
Ketahui Lebih LanjutOAuth 2.0
Aliran kod kebenaran dengan PKCE dan putaran refresh token membolehkan aplikasi anda bertindak bagi pihak pengguna s.id.
Ketahui Lebih LanjutPermulaan Pantas
Cipta pautan pendek dalam satu panggilan API.
Buka Dashboard → Pembangun → Kunci API
Cipta kunci dengan skop yang anda perlukan
Panggil API dengan Bearer sk_live_...
URL Asas: https://api.s.id/v2
curl -X POST https://api.s.id/v2/links \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"long_url": "https://example.com/long-url", "custom_slug": "mylink"}'Titik Akhir
Semua titik akhir memerlukan kunci API dengan skop yang sesuai.
| Kaedah | Laluan |
|---|---|
| GET | /links |
| POST | /links |
| POST | /links/available |
| GET | /links/{short} |
| PUT | /links/{short} |
| DELETE | /links/{short} |
| POST | /links/{short}/unarchive |
| GET | /links/{short}/stats |
| GET | /links/{short}/stats/lifetime |
| GET | /user |
| GET | /quota |
| GET | /microsites |
| POST | /microsites |
| GET | /microsites/{slug} |
| PUT | /microsites/{slug} |
| DELETE | /microsites/{slug} |
| POST | /links/bulk |
| GET | /stats |
| GET | /qr |
| PUT | /qr |
| GET | /links/{short}/qr |
| PUT | /links/{short}/qr |
| POST | /microsites/available |
| GET | /microsites/{slug}/components |
| POST | /microsites/{slug}/components |
| PUT | /microsites/{slug}/components/{componentId} |
| DELETE | /microsites/{slug}/components/{componentId} |
| POST | /microsites/{slug}/components/order |
| GET | /oauth/authorize |
| POST | /oauth/token |
| POST | /oauth/revoke |
| GET | /oauth/userinfo |
| GET | /api/user/oauth/apps |
| DELETE | /api/user/oauth/apps/{clientId} |
Skop API
Setiap kunci API mempunyai skop — minta hanya kebenaran yang diperlukan integrasi anda.
links:readList and read linkslinks:writeCreate and update links (create, edit, restore)links:archiveArchive linkslinks:analyticsRead per-link click statistics and lifetime countsqr:readRead QR code settings (global and per-link)qr:writeCustomize QR code settings (global and per-link)user:readRead the authenticated user profile and account quotamicrosites:readRead micrositesmicrosites:writeCreate, update, delete and manage components of micrositesWebhooks
Daftarkan titik akhir HTTPS untuk menerima acara masa nyata. Setiap penghantaran ditandatangani POST dengan HMAC-SHA256.
Acara yang tersedia
link.createdFired when a new link is createdlink.updatedFired when a link's URL or title is changedlink.archivedFired when a link is archivedlink.clickedFired on each redirect (per-click event)microsite.publishedFired when a microsite is publishedqr.scannedFired when a QR code is scannedContoh muatan
{
"event": "link.created",
"link": {
"id": 123,
"short": "mylink",
"short_url": "https://s.id/mylink",
"long_url": "https://example.com/long-url",
"title": "My Link",
"created": "2026-06-22T10:00:00Z"
},
"timestamp": "2026-06-22T10:00:00Z"
}Sahkan tandatangan (Node.js)
const crypto = require('crypto');
function verifySignature(secret, rawBody, sigHeader) {
const expected = 'sha256=' +
crypto.createHmac('sha256', secret).update(rawBody).digest('hex');
return crypto.timingSafeEqual(
Buffer.from(sigHeader),
Buffer.from(expected),
);
}Rahsia dipaparkan sekali semasa anda mencipta webhook. Sahkan sebelum memproses acara.
Pengesahan
Dua cara pengesahan: kunci API untuk pelayan-ke-pelayan, OAuth 2.0 untuk aliran bagi pihak pengguna.
Kunci API
Cipta kunci di Dashboard → Pembangun → Kunci API. Hantarkan sebagai token Bearer. Kunci mempunyai skop dan boleh dibatalkan pada bila-bila masa.
Authorization: Bearer sk_live_...OAuth 2.0
Gunakan aliran kod kebenaran untuk bertindak bagi pihak pengguna s.id. Alihkan ke /oauth/authorize, tukar kod di /oauth/token.
Panduan OAuth 2.0Bersedia untuk mula membina?
Cipta kunci API dalam beberapa minit. Peringkat percuma disertakan — tiada kad kredit diperlukan.