Sign in Join now

Code examples

Start from these. Put your key in an environment variable, never in your code.

Your profile (GET /me)

curl -s https://www.pxthway.com/api/v1/me \
  -H "Authorization: Bearer $VIQ_API_KEY"
const res = await fetch("https://www.pxthway.com/api/v1/me", {
  headers: { Authorization: `Bearer ${process.env.VIQ_API_KEY}` },
});
if (!res.ok) throw new Error((await res.json()).error.message);
const { data } = await res.json();
console.log(data.name, data.username);
import os, requests

res = requests.get("https://www.pxthway.com/api/v1/me", headers={"Authorization": f"Bearer {os.environ['VIQ_API_KEY']}"}, timeout=10)
res.raise_for_status()
print(res.json()["data"]["name"])

Every page of a list

let cursor = null;
do {
  const url = new URL("https://www.pxthway.com/api/v1/me/posts");
  url.searchParams.set("limit", "50");
  if (cursor) url.searchParams.set("cursor", cursor);
  const res = await fetch(url, { headers: { Authorization: `Bearer ${process.env.VIQ_API_KEY}` } });
  const body = await res.json();
  for (const post of body.data) console.log(post.id);
  cursor = body.next;
} while (cursor);

Limits and errors

Every answer carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. An error answers with { "error": { "status", "code", "message", "requestId" } }; wait for the reset after a 429, and quote the requestId if you contact us.

The full guide and every endpoint · OpenAPI document · Security