ブログチュートリアル

PureSnap Open API Quickstart: Keys, Auth and First Parse

Create a key, add an IP allow-list, call /parse and read the result. Covers auth headers, batch limits, billing, callbacks and error codes.

Nov 5, 2026 公開Nov 5, 2026 更新約 6 分

The open API is for server-side integrations: a bot, a backend job, a spreadsheet tool or another service that needs to turn public share links into media addresses. Keys are self-service. You do not need to contact support to get one.

The flow is short: create a key, allow-list the machine that will call the API, send a link, then poll for the result or receive a callback. The parts that cause most support tickets are the mandatory IP allow-list and the billing rule for retries, so this guide covers both explicitly.

Quick answer

Create a key under /user/api-keys, add at least one IP allow-list entry, and copy the SecretKey while it is shown. POST a public link to /api/open/v1/parse with the key headers, then poll /task/{taskId} or configure a callback. Query endpoints do not consume parse credits. A failed parse is refunded automatically.

Before you start

  • A PureSnap account with enough credits for the calls you plan to make.
  • The egress IP of the machine that will call the API. For a local test, 127.0.0.1 is enough.
  • A server-side place to store the SecretKey. Do not put it in front-end code or a public repository.

Create a key

  1. Sign in and open /user/api-keys.
  2. Press Create key.
  3. Fill in a name that identifies the environment, such as production-node.
  4. Add 1 to 5 IP allow-list entries.
  5. Set QPS, daily limit, total limit and valid days. Zero means unlimited for the first three; zero days means the key does not expire.
  6. Optionally add a callback URL, up to 512 characters.
  7. Copy the full SecretKey immediately. It is shown once.

Each account can hold up to 20 keys. Create separate keys per environment so you can disable one without breaking the others.

The IP allow-list is mandatory

A key with no allow-list entry cannot call any endpoint and returns 6011. Entries accept a single IPv4 address, a CIDR block such as 203.0.113.0/24, or a last-octet wildcard such as 203.0.113.*. A key whose source IP is not covered returns 6004.

The wildcard forms * and 0.0.0.0/0 may be restricted to exempt accounts and return 6012. If you need to allow many addresses, list the smallest set of CIDR blocks that covers them.

Authenticate

Send one credential pair with every request. These three forms are equivalent:

  • Header X-Api-Key with the AccessKey, plus X-Api-Secret with the SecretKey.
  • Header Authorization with the value ApiKey wmkx:wmsy.
  • Header X-Access-Key with the AccessKey, plus X-Secret-Key with the SecretKey.

The AccessKey starts with wmk. It identifies the key. The SecretKey starts with wms and acts as a password.

First request

Replace the placeholders with your domain and credentials:

curl -X POST "https://your-domain.com/api/open/v1/parse" -H "Content-Type: application/json" -H "X-Api-Key: wmk_xxxxxxxx" -H "X-Api-Secret: wms_yyyyyyyy" -d '{"url":"https://v.douyin.com/xxxxxxx/"}

A successful submission returns a task ID, an initial status and the remaining balance.

Read the result

  • Poll GET /api/open/v1/task/{taskId}. The task moves from PENDING to PARSING to DOWNLOADING to SUCCESS. A failure ends as FAILED and is followed by REFUNDED.
  • The waitMs parameter lets a poll wait up to 50 seconds instead of returning immediately.
  • POST /api/open/v1/parse-sync submits and waits up to 20 seconds by default. A timeout is not a failure. Do not resubmit the same link; use the task ID to keep polling.
  • The same content submitted again within 24 hours reuses the stored result and does not charge twice.
  • A failed parse is refunded automatically.
  • The downloadUrl field points at the upstream CDN. It can expire or reject requests. If it returns 403, submit the link again.

Batch

  • POST /api/open/v1/parse/batch accepts up to 50 links. More than 50 returns 7501.
  • Each accepted item is a normal task and is charged separately. Items rejected before a task is created are not charged.
  • GET /api/open/v1/batch/{batchId} returns per-item status. A partial failure is not a whole-batch error.
  • POST /api/open/v1/batch/{batchId}/retry resubmits failed or refunded items as a new batch. Retried items are charged again when accepted.

Optional callback

If you configure a callback URL, PureSnap POSTs task.finished or batch.finished events. The request includes an X-PS-Timestamp header and an HMAC-SHA256 signature over the timestamp, a dot and the raw body, using the SecretKey. Reject timestamps older than 5 minutes.

Respond with a 2xx status within 10 seconds. Failed deliveries are retried immediately, then after about 5 seconds, then after about 30 seconds. Redirects are not followed. Callbacks are best-effort, so keep polling as a fallback. Internal, loopback and metadata addresses are refused.

Limits and error codes

  • 6005 means the per-key QPS limit was exceeded.
  • 6006 means the daily call limit was reached.
  • 6013 means the total call limit for the key was reached and will not reset.
  • 2001 means the account has no parse credits left.
  • Query endpoints (task, batch, history, account, ping) do not consume parse credits, but they do count toward daily and total call limits and QPS.
  • If the key's remaining call quota cannot cover an entire batch, the whole batch is rejected with 6006 or 6013. It is not partially accepted.
  • HTTP status is always 200. Decide success from the body code.

Other common codes: 2003 for an unrecognised platform, 2004 for a parse failure that has been refunded, 2005 for a link over 1024 characters, 6001 for an invalid or deleted key, 6002 for a disabled key, 6003 for an expired key, 6011 for a missing allow-list, and 7500 to 7505 for batch problems.

Security notes

  • Treat the SecretKey like a password. Store it server-side and rotate it if it leaks.
  • Reset a key to replace only the SecretKey. The old secret stops working immediately.
  • Disabling a key stops API calls immediately, but callbacks for already finished work may still be sent.
  • Verify callback signatures before trusting a payload.

Frequently asked questions

Can I create an API key without contacting support?

Yes. Keys are self-service under /user/api-keys. Each account can hold up to 20.

Why do I get 6011 on every request?

The key has no IP allow-list entry. Add the calling machine to the allow-list. Use 127.0.0.1 for a local test.

Does polling a task cost a credit?

No. Query endpoints are free of parse credits, though they count toward the call limits and QPS of the key.

What happens if I resubmit the same link?

Within 24 hours, the stored result is reused and you are not charged again. After that, it is a new task.

Is the download URL permanent?

No. It points at the upstream CDN and can expire. Re-parse the link if it stops working.

Do failed parses cost anything?

No. They are refunded automatically and end in the REFUNDED state.

著作権を保有している、または使用許諾を得たコンテンツのみをダウンロードし、各プラットフォームの規約を守ってください。

自分のリンクで試す

共有リンクを貼るだけでブラウザ内で解析できます。インストールは不要です。

複数リンクをまとめて送信、1 件ごとに課金
TikTok / Kwai / YouTube / Instagram / Facebook / X などに対応共有テキストをそのまま貼り付け即可。リンクは自動抽出します