Links and bio pages
links scope and cost nothing.Shorten a link
POST /v1/links creates a short link at /l/SLUG. The response has the shortUrl to share and the finalUrl visitors are sent to, with your UTM parameters added.
curl -X POST "https://postkea.com/api/v1/links" \
-H "Authorization: Bearer $POSTKEA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"destination": "https://studiolumen.com/workshops",
"slug": "spring",
"utm": {
"source": "instagram",
"medium": "social",
"campaign": "spring-workshop"
}
}'const res = await fetch("https://postkea.com/api/v1/links", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.POSTKEA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
destination: "https://studiolumen.com/workshops",
slug: "spring",
utm: {
source: "instagram",
medium: "social",
campaign: "spring-workshop",
},
}),
});
const { data: link } = await res.json();
console.log(link);import os, requests
r = requests.post(
"https://postkea.com/api/v1/links",
headers={"Authorization": f"Bearer {os.environ['POSTKEA_API_KEY']}"},
json={
"destination": "https://studiolumen.com/workshops",
"slug": "spring",
"utm": {
"source": "instagram",
"medium": "social",
"campaign": "spring-workshop",
},
},
)
link = r.json()["data"]
print(link){
"success": true,
"data": {
"id": "lnk_2Vb7",
"slug": "spring",
"destination": "https://studiolumen.com/workshops",
"shortUrl": "https://postkea.com/l/spring",
"finalUrl": "https://studiolumen.com/workshops?utm_source=instagram&utm_medium=social&utm_campaign=spring-workshop",
"clicks": 0
}
}Click stats
GET /v1/links/{id}/stats returns the total and daily clicks of the last days days, broken down by country, device, browser and referrer. GET /v1/links lists links with their click counts; PATCH and DELETE /v1/links/{id} change or remove one.
curl "https://postkea.com/api/v1/links/lnk_2Vb7/stats?days=30" \
-H "Authorization: Bearer $POSTKEA_API_KEY"const res = await fetch("https://postkea.com/api/v1/links/lnk_2Vb7/stats?days=30", {
headers: { Authorization: `Bearer ${process.env.POSTKEA_API_KEY}` },
});
const { data: stats } = await res.json();
console.log(stats);import os, requests
r = requests.get(
"https://postkea.com/api/v1/links/lnk_2Vb7/stats",
headers={"Authorization": f"Bearer {os.environ['POSTKEA_API_KEY']}"},
params={
"days": 30,
},
)
stats = r.json()["data"]
print(stats)Links in posts
In the workspace settings (PATCH /v1/workspace), defaultUtm adds UTM parameters to every link in your posts, with utm_source set to the network, and shortenLinks turns every link into a trackable short link before the post goes out.
Link-in-bio pages
A bio page is a small public page at /b/SLUG to put in your profiles. Create it with POST /v1/bio-pages; GET /v1/bio-pages/{id} returns the page with its subscriber count and the click stats of the last 30 days, including clicks per block.
curl -X POST "https://postkea.com/api/v1/bio-pages" \
-H "Authorization: Bearer $POSTKEA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"slug": "studiolumen",
"title": "Studio Lumen",
"bio": "Handmade ceramics from Berlin.",
"blocks": [
{
"id": "b1",
"type": "link",
"label": "Book a workshop",
"url": "https://studiolumen.com/workshops"
},
{
"id": "b2",
"type": "social",
"url": "https://instagram.com/studio.lumen"
},
{
"id": "b3",
"type": "email",
"label": "Get the monthly newsletter"
}
]
}'const res = await fetch("https://postkea.com/api/v1/bio-pages", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.POSTKEA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
slug: "studiolumen",
title: "Studio Lumen",
bio: "Handmade ceramics from Berlin.",
blocks: [
{
id: "b1",
type: "link",
label: "Book a workshop",
url: "https://studiolumen.com/workshops",
},
{
id: "b2",
type: "social",
url: "https://instagram.com/studio.lumen",
},
{
id: "b3",
type: "email",
label: "Get the monthly newsletter",
},
],
}),
});
const { data: page } = await res.json();
console.log(page);import os, requests
r = requests.post(
"https://postkea.com/api/v1/bio-pages",
headers={"Authorization": f"Bearer {os.environ['POSTKEA_API_KEY']}"},
json={
"slug": "studiolumen",
"title": "Studio Lumen",
"bio": "Handmade ceramics from Berlin.",
"blocks": [
{
"id": "b1",
"type": "link",
"label": "Book a workshop",
"url": "https://studiolumen.com/workshops",
},
{
"id": "b2",
"type": "social",
"url": "https://instagram.com/studio.lumen",
},
{
"id": "b3",
"type": "email",
"label": "Get the monthly newsletter",
},
],
},
)
page = r.json()["data"]
print(page)Blocks
Every block has an id, a type and optional label, url, text, imageUrl and hidden.
Email subscribers
Emails collected by an email block are listed by GET /v1/bio-pages/{id}/subscribers. The form on the page posts to the public POST /v1/public/bio/{slug}/subscribe endpoint.