s.id Logo
s.id
Developer Platform

Bumuo sa s.id — REST API, Webhooks & OAuth

Gumawa ng maikling link, subaybayan ang mga click, at i-automate ang iyong workflow gamit ang developer platform ng s.id. Simpleng API key auth, real-time webhooks, at OAuth 2.0 para sa third-party apps.

REST API

Pamahalaan ang mga link, QR code, at data ng user gamit ang malinis na JSON API. Bearer token auth, 38 req/min.

Alamin Pa

Webhooks

Mag-subscribe sa link.created, link.clicked, qr.scanned, at iba pa. HMAC-signed na mga payload.

Alamin Pa

OAuth 2.0

Ang authorization-code flow na may PKCE at refresh token rotation ay nagpapahintulot sa iyong app na kumilos para sa mga user ng s.id.

Alamin Pa

Mabilis na Simula

Gumawa ng maikling link sa isang API call.

1

Buksan ang Dashboard → Developer → API Keys

2

Gumawa ng key na may mga scope na kailangan mo

3

Tawagan ang API gamit ang Bearer sk_live_...

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

Mga Endpoint

Lahat ng endpoint ay nangangailangan ng API key na may tamang scope.

ParaanPath
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}
Kumpletong API Reference ↗

Mga API Scope

Ang bawat API key ay may scope — humiling lamang ng mga permiso na kailangan ng iyong integrasyon.

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

Webhooks

Irehistro ang isang HTTPS endpoint para makatanggap ng real-time na mga event. Ang bawat delivery ay POST-signed gamit ang HMAC-SHA256.

Mga available na event

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

Halimbawa ng 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"
}

I-verify ang signature (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),
  );
}

Ang secret ay ipinapakita nang isang beses kapag gumawa ka ng webhook. I-verify bago iproseso ang event.

Kumpletong gabay sa webhooks

Pagpapatunay

Dalawang paraan ng pagpapatunay: API key para sa server-to-server, OAuth 2.0 para sa mga daloy sa ngalan ng user.

Mga API Key

Gumawa ng key sa Dashboard → Developer → API Keys. Ipasa ito bilang Bearer token. Ang mga key ay may scope at maaaring bawiin sa anumang oras.

Authorization: Bearer sk_live_...

OAuth 2.0

Gamitin ang authorization-code flow para kumilos para sa mga user ng s.id. Mag-redirect sa /oauth/authorize, palitan ang code sa /oauth/token.

Gabay sa OAuth 2.0

Handa na bang magsimulang bumuo?

Gumawa ng API key sa loob ng ilang minuto. Kasama ang libreng tier — walang credit card na kailangan.