SNX API

Dokumentasi resmi untuk integrasi shortlink.

Autentikasi

Info Limit: API Key default memiliki batas penggunaan 5.000 request.

Gunakan API Key berikut untuk pengujian:

Key: saxia

Endpoint Utama

GET /api/create

Parameter

Param Wajib Keterangan
url YES Link tujuan asli
apikey YES Gunakan saxia
code NO Custom alias (unik)
exp NO Isi 7, 15, atau kosong

Response Sukses

{
  "status": true,
  "short": "https://snx.biz.id/group",
  "code": "group",
  "expiredAt": null
}

Response Gagal

{
  "error": "Invalid API key"
}

Contoh Kode

cURL

curl "https://snx.biz.id/api/create?url=https://google.com&apikey=saxia"

Node.js

const axios = require("axios");

async function createLink() {
  try {
    const response = await axios.get("https://snx.biz.id/api/create", {
      params: {
        url: "https://google.com",
        apikey: "saxia",
        code: "custom123"
      }
    });
    console.log(response.data.short);
  } catch (error) {
    console.error(error);
  }
}

createLink();

Python

import requests

params = {
    "url": "https://google.com",
    "apikey": "saxia",
    "code": "pythonlink"
}

res = requests.get("https://snx.biz.id/api/create", params=params)
print(res.json().get("short"))

PHP

<?php
$url = "https://snx.biz.id/api/create?url=https://google.com&apikey=saxia";
$response = file_get_contents($url);
$data = json_decode($response, true);
echo $data['short'];
?>

Go

package main

import (
    "fmt"
    "io"
    "net/http"
)

func main() {
    resp, _ := http.Get("https://snx.biz.id/api/create?url=https://google.com&apikey=saxia")
    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}