s.id Logo
Platform Developer

Bangun di atas s.id — REST API, Webhook & OAuth

Buat short link, lacak klik, dan otomatiskan alur kerja Anda dengan platform developer s.id. Autentikasi API key yang mudah, webhook real-time, dan OAuth 2.0 untuk aplikasi pihak ketiga.

REST API

Kelola link, kode QR, dan data pengguna dengan API JSON yang bersih. Autentikasi Bearer token, 38 req/menit.

Pelajari Lebih Lanjut

Webhook

Langganan link.created, link.clicked, qr.scanned, dan lainnya. Payload bertanda tangan HMAC.

Pelajari Lebih Lanjut

OAuth 2.0

Alur authorization-code dengan PKCE dan rotasi refresh token memungkinkan aplikasi Anda bertindak atas nama pengguna s.id.

Pelajari Lebih Lanjut

Mulai Cepat

Buat short link dalam satu panggilan API.

1Buka Dashboard → Developer → API Keys
2Buat kunci dengan scope yang Anda butuhkan
3Panggil API dengan Bearer sk_live_...

URL Dasar: 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"}'

Endpoint

Semua endpoint memerlukan API key dengan scope yang sesuai.

Referensi API Lengkap ↗
MetodePathDeskripsiScope
GET/linksList linkslinks:read
POST/linksCreate a linklinks:write
POST/links/availableCheck slug availabilitylinks:read
GET/links/{short}Get a linklinks:read
PUT/links/{short}Update a linklinks:write
DELETE/links/{short}Archive a linklinks:archive
POST/links/{short}/unarchiveRestore an archived linklinks:write
GET/links/{short}/statsLink click timelinelinks:analytics
GET/links/{short}/stats/lifetimeLifetime click countlinks:analytics
GET/userGet authenticated useruser:read
GET/quotaGet account quotauser:read
GET/micrositesList micrositesmicrosites:read
POST/micrositesCreate a micrositemicrosites:write
GET/microsites/{slug}Get a micrositemicrosites:read
PUT/microsites/{slug}Update a micrositemicrosites:write
DELETE/microsites/{slug}Delete a micrositemicrosites:write
POST/links/bulkBulk create linkslinks:write
GET/statsAccount-level click analyticslinks:analytics
GET/qrGet global QR settingsqr:read
PUT/qrCustomize global QR settingsqr:write
GET/links/{short}/qrGet a link's QR settingsqr:read
PUT/links/{short}/qrCustomize a link's QR settingsqr:write
POST/microsites/availableCheck microsite slug availabilitymicrosites:read
GET/microsites/{slug}/componentsList microsite componentsmicrosites:read
POST/microsites/{slug}/componentsAdd a microsite componentmicrosites:write
PUT/microsites/{slug}/components/{componentId}Update a microsite componentmicrosites:write
DELETE/microsites/{slug}/components/{componentId}Delete a microsite componentmicrosites:write
POST/microsites/{slug}/components/orderReorder microsite componentsmicrosites:write
GET/oauth/authorizeGet consent screen data
POST/oauth/tokenExchange code or refresh token
POST/oauth/revokeRevoke a token
GET/oauth/userinfoGet authorized user profile
GET/api/user/oauth/appsList apps authorized by the current user
DELETE/api/user/oauth/apps/{clientId}Revoke all tokens for an app

Scope API

Setiap API key memiliki scope — minta hanya izin yang dibutuhkan integrasi Anda.

links:readList and read links
links:writeCreate and update links (create, edit, restore)
links:archiveArchive links
links:analyticsRead per-link click statistics and lifetime counts
qr: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 quota
microsites:readRead microsites
microsites:writeCreate, update, delete and manage components of microsites

Webhook

Daftarkan endpoint HTTPS untuk menerima event real-time. Setiap pengiriman ditandatangani POST dengan HMAC-SHA256.

Event yang tersedia

link.createdFired when a new link is created
link.updatedFired when a link's URL or title is changed
link.archivedFired when a link is archived
link.clickedFired on each redirect (per-click event)
microsite.publishedFired when a microsite is published
qr.scannedFired when a QR code is scanned

Contoh payload

{
  "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"
}

Verifikasi tanda tangan (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),
  );
}

Secret ditampilkan sekali saat Anda membuat webhook. Verifikasi sebelum memproses event.

Panduan lengkap webhook

API Key

Buat kunci di Dashboard → Developer → API Keys. Kirimkan sebagai token Bearer. Kunci memiliki scope dan dapat dicabut kapan saja.

Authorization: Bearer sk_live_...

OAuth 2.0

Gunakan alur authorization-code untuk bertindak atas nama pengguna s.id. Arahkan ke /oauth/authorize, tukarkan kode di /oauth/token.

Panduan OAuth 2.0

Siap mulai membangun?

Buat API key dalam hitungan menit. Sudah termasuk tier gratis — tanpa kartu kredit.