Skip to main content
Hệ thống bọc Link VPCS

API docs

BocLink API v1

v1 · stable

Create and manage wrapped (cloaked) links straight from your server, CRM or automation tools. The API is RESTful and speaks JSON over HTTPS.

Base URLhttps://vpcs.vn/api/v1
Get an API key

Quick start

  1. 1

    Create an API key

    Go to Dashboard → API, click “Create key” and store the key (bl_…) somewhere safe.

  2. 2

    Call POST /links

    Send the destination (url) and a safe page for bots (safeUrl). You get a wrapped link back.

  3. 3

    Use wrapUrl

    Paste wrapUrl into your ads. Bots see safeUrl; real visitors are sent to url.

curl -X POST https://vpcs.vn/api/v1/links \
  -H "Authorization: Bearer $BOCLINK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://shop.example.com/offer",
  "safeUrl": "https://shop.example.com/blog",
  "title": "Sale 11.11 · Facebook",
  "allowedCountries": ["VN"]
}'

Authentication

Every request must send your API key in the Authorization header as a Bearer token. A key belongs to the account that created it and acts with that account's permissions in its selected workspace.

You can create up to 10 keys and revoke any of them at any time in Dashboard → API. Revoked keys and suspended accounts get 401 / 403 immediately.

Header
Authorization: Bearer bl_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Keep keys server-side. Never ship them in browser JavaScript, mobile apps or public repositories.

Rate limits

Each key can make up to 120 requests per minute. Going over returns 429 with a Retry-After header (seconds to wait). Every response includes:

X-RateLimit-Limitheader
Maximum requests per minute.
X-RateLimit-Remainingheader
Requests left in the current minute.
X-RateLimit-Resetheader
When the counter resets (Unix time, seconds).

Errors

Errors use the matching HTTP status and a JSON body whose error field explains the cause (validation errors name the offending field).

  • 400Invalid input: malformed JSON, missing required field, bad URL, unsupported field.
  • 401Missing API key, or the key is wrong / revoked.
  • 403Account suspended, plan expired, or link quota reached.
  • 404Link not found, or it isn't in your workspace.
  • 429Rate limit exceeded — wait for Retry-After, then retry.
  • 500Server error — retry later; contact support if it persists.
Response 400
{
  "error": "safeUrl phải là URL http(s) hợp lệ."
}

Endpoints

Account & quota

GET/api/v1/me

The account that owns the key, its current plan and links used / allowed (-1 = unlimited). Handy for checking that a key works.

cURL
curl https://vpcs.vn/api/v1/me \
  -H "Authorization: Bearer $BOCLINK_API_KEY"
Response 200
{
  "user": { "id": "6741…", "email": "you@company.com", "name": "Minh Anh" },
  "plan": { "name": "Pro", "slug": "pro" },
  "subscription": { "active": true, "expiresAt": "2027-01-06T00:00:00.000Z" },
  "usage": { "links": 42, "maxLinks": 500, "domains": 1, "maxDomains": 5 }
}

List domains

GET/api/v1/domains

Domains you can use when creating links. Pass an id as domainId; leave domainId out to use your default domain.

cURL
curl https://vpcs.vn/api/v1/domains \
  -H "Authorization: Bearer $BOCLINK_API_KEY"
Response 200
{
  "domains": [
    { "id": "6741aa00bb11cc22dd33ee44", "hostname": "go.yourbrand.com",
      "isDefault": true, "shared": false, "teamName": null }
  ]
}