# Link in bio

> POST /link-in-bio reads a link-in-bio page or personal site after robots.txt and returns every outbound link, each tagged with its platform, with the page's title and image.

`POST https://api.qelka.com/v1/link-in-bio`

Turn a link-in-bio page or a personal homepage into a clean list of the links it points to, each tagged with its platform: YouTube, TikTok, X, Spotify, Telegram, an email address, a phone number or a plain website. The page is read after robots.txt and the site's terms, and no script is run. Each lookup costs 1 credit when the page could be read.

## Request

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `url` | string | Yes | none | The address of the page, with or without `https://`, 1 to 2,048 characters. |
| `fresh` | boolean | No | `false` | `true` skips the 24-hour result cache and reads the page again. |

Only public hosts are read: an IP address, `localhost` or a private suffix such as `.local` or `.internal` is a `422 unprocessable_input`. The fragment of the URL is dropped; the path and query are kept.

```bash title="cURL"
curl https://api.qelka.com/v1/link-in-bio \
  --max-time 30 \
  -H "Authorization: Bearer $QELKA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "solo.to/solo"}'
```
```javascript title="Node.js"
const response = await fetch('https://api.qelka.com/v1/link-in-bio', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.QELKA_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ url: 'solo.to/solo' }),
  signal: AbortSignal.timeout(30_000),
})
const result = await response.json()
console.log(result)
```
```python title="Python"
import os

import requests

api_key = os.environ["QELKA_API_KEY"]
response = requests.post(
    "https://api.qelka.com/v1/link-in-bio",
    headers={"Authorization": f"Bearer {api_key}"},
    json={"url": "solo.to/solo"},
    timeout=30,
)
result = response.json()
print(result)
```
```php title="PHP"
<?php
$ch = curl_init('https://api.qelka.com/v1/link-in-bio');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('QELKA_API_KEY'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode(['url' => 'solo.to/solo']),
    CURLOPT_TIMEOUT => 30,
]);
$result = json_decode(curl_exec($ch), true);
print_r($result);
```
```go title="Go"
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"os"
	"time"
)

func main() {
	payload, _ := json.Marshal(map[string]any{"url": "solo.to/solo"})
	request, _ := http.NewRequest(http.MethodPost, "https://api.qelka.com/v1/link-in-bio", bytes.NewReader(payload))
	request.Header.Set("Authorization", "Bearer "+os.Getenv("QELKA_API_KEY"))
	request.Header.Set("Content-Type", "application/json")

	client := &http.Client{Timeout: 30 * time.Second}
	response, err := client.Do(request)
	if err != nil {
		panic(err)
	}
	defer response.Body.Close()

	var result map[string]any
	if err := json.NewDecoder(response.Body).Decode(&result); err != nil {
		panic(err)
	}
	fmt.Println(result)
}
```
```ruby title="Ruby"
require 'json'
require 'net/http'

uri = URI('https://api.qelka.com/v1/link-in-bio')
request = Net::HTTP::Post.new(uri)
request['Authorization'] = "Bearer #{ENV.fetch('QELKA_API_KEY')}"
request['Content-Type'] = 'application/json'
request.body = JSON.generate({ url: 'solo.to/solo' })

response = Net::HTTP.start(uri.host, uri.port, use_ssl: true, read_timeout: 30) do |http|
  http.request(request)
end
result = JSON.parse(response.body)
puts result
```

## Response

Every public page gets a `200`. Read `status` first: only `ok` means the page was read.

| Field | Type | Description |
|---|---|---|
| `id` | string | Identifier of this lookup: `lkp_` followed by 26 characters. |
| `object` | string | Always `link_in_bio`. |
| `input` | string | The `url` you sent, without surrounding spaces. |
| `url` | string | The page that was requested, with `https://` added when missing. |
| `final_url` | string or null | The page after redirects. `null` when the page was not fetched. |
| `host` | string | Host of `final_url`, or of `url` when `final_url` is `null`. |
| `status` | string | `ok`, `not_permitted`, `robots_disallowed`, `unreachable`, `http_error` or `not_html`. |
| `http_status` | integer or null | HTTP status of the page. `null` when it was not fetched. |
| `title` | string or null | `og:title` of the page, else its title. |
| `description` | string or null | The meta description, else `og:description`. |
| `image` | string or null | Absolute URL of the `og:image` or `twitter:image` preview. |
| `links` | array of objects | Every link that leaves the site, in page order, without duplicates, at most 100. Empty unless `status` is `ok`. |
| `links.url` | string | The link: an `http(s)` URL, a `mailto:` or a `tel:` link. |
| `links.platform` | string | The platform the link points to, such as `youtube`, `x`, `telegram`, `email`, `phone` or `website` for any other site. |
| `links.name` | string | The display name of the platform. |
| `links.text` | string or null | The text of the link on the page. |
| `links.handle` | string or null | The handle read from the URL, the address of an email link or the number of a phone link. |
| `credits_used` | integer | Credits debited for this call: 1 when `status` is `ok` with a live key, else `0`. |
| `cached` | boolean | `true` when the answer came from the 24-hour cache. |

```json title="Response"
{
  "id": "lkp_01M8CEGAJP94BP3MF2ZA0WTKA9",
  "object": "link_in_bio",
  "input": "solo.to/solo",
  "url": "https://solo.to/solo",
  "final_url": "https://solo.to/solo",
  "host": "solo.to",
  "status": "ok",
  "http_status": 200,
  "title": "solo · solo.to",
  "description": "Dubai · Avid Opportunist",
  "image": "https://cdn.solo.to/og/solo.jpg",
  "links": [
    { "url": "https://t.me/xsolobusiness", "platform": "telegram", "name": "Telegram", "text": "xsolobusiness", "handle": "xsolobusiness" },
    { "url": "https://x.com/solobusiness", "platform": "x", "name": "X", "text": null, "handle": "solobusiness" },
    { "url": "mailto:solo@sent.com", "platform": "email", "name": "Email", "text": null, "handle": "solo@sent.com" }
  ],
  "credits_used": 1,
  "cached": false
}
```

## Act on the status

| `status` | What it means | What to do | Billed |
|---|---|---|---|
| `ok` | The page was read. | Use `links`. An empty array means the page has no outbound link in its HTML. | Yes, and cached 24 hours |
| `not_permitted` | The site's terms forbid automated reads, or it answers automated requests with a challenge, so nothing was fetched. | Use the link page another way, or ask the owner for their links. | No |
| `robots_disallowed` | robots.txt disallows the page, or answered a server error, which [RFC 9309](https://www.rfc-editor.org/rfc/rfc9309) treats as a full disallow; or a redirect led to a disallowed page. | Respect it: the site does not want automated reads. | No |
| `unreachable` | The page did not answer within the timeout, or redirected too many times. | Check the address, or try again later. | No |
| `http_error` | The page answered a 4xx or 5xx status, given in `http_status`. | Check the address for a 4xx; try again later for a 5xx. | No |
| `not_html` | The page is not an HTML page. | Check that the address points to a web page. | No |

Answers other than `ok` are never cached.

## How the page is read

1. Hosts whose terms forbid automated reads, or that answer automated requests with a challenge, are refused before any request: Linktree, Beacons, Carrd, about.me, bio.link, lnk.bio, and the profile pages of social networks such as Instagram, TikTok, X, Facebook, LinkedIn, YouTube and Reddit.
2. robots.txt is read. The rules of the group for the `Qelka` user agent apply, else those of `*`; a missing robots.txt allows everything.
3. The page is fetched with the User-Agent `Qelka-API/1.0 (+https://qelka.com; support@qelka.com)`, a 6-second timeout and a 1,500 kB cap. When it redirects to another site, that site's terms and robots.txt are checked too.
4. The HTML is parsed without running scripts. Links to the page's own site, such as its sign-in or legal pages, are dropped; the others are classified by their host.

A page that draws its links with JavaScript comes back with `status` `ok` and fewer links, or none.

## What the API keeps

The API returns only what the page publishes. The request log keeps only the host of the URL you sent. An email address or phone number on a link page can belong to a person: use it the way its owner intends.

## Examples

### Read a page with a test key

Test keys return a simulated page without fetching anything. With a test key in `QELKA_API_KEY`, this request returns:

```bash title="cURL"
curl https://api.qelka.com/v1/link-in-bio \
  --max-time 30 \
  -H "Authorization: Bearer $QELKA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "solo.to/example"}'
```
```javascript title="Node.js"
const response = await fetch('https://api.qelka.com/v1/link-in-bio', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.QELKA_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ url: 'solo.to/example' }),
  signal: AbortSignal.timeout(30_000),
})
const result = await response.json()
console.log(result)
```
```python title="Python"
import os

import requests

api_key = os.environ["QELKA_API_KEY"]
response = requests.post(
    "https://api.qelka.com/v1/link-in-bio",
    headers={"Authorization": f"Bearer {api_key}"},
    json={"url": "solo.to/example"},
    timeout=30,
)
result = response.json()
print(result)
```

```json title="Response"
{
  "id": "lkp_01M8CH2RJ6TN1YB5FQ3VWZE8HK",
  "object": "link_in_bio",
  "input": "solo.to/example",
  "url": "https://solo.to/example",
  "final_url": "https://solo.to/example",
  "host": "solo.to",
  "status": "ok",
  "http_status": 200,
  "title": "Example Creator",
  "description": "A simulated link page returned to test keys.",
  "image": null,
  "links": [
    { "url": "https://github.com/example", "platform": "github", "name": "GitHub", "text": "Code", "handle": "example" },
    { "url": "https://bsky.app/profile/example.com", "platform": "bluesky", "name": "Bluesky", "text": "Bluesky", "handle": "example.com" },
    { "url": "https://www.youtube.com/@example", "platform": "youtube", "name": "YouTube", "text": "Videos", "handle": "example" },
    { "url": "https://example.com/", "platform": "website", "name": "Website", "text": "Website", "handle": null },
    { "url": "mailto:hello@example.com", "platform": "email", "name": "Email", "text": "Email me", "handle": "hello@example.com" }
  ],
  "credits_used": 0,
  "cached": false
}
```

## Errors

| Status | Type | When |
|---|---|---|
| 400 | [invalid_request](https://qelka.com/docs/errors#invalid_request) | `url` is missing, empty or longer than 2,048 characters, the body is not a JSON object, or it has a field the request table does not list |
| 401 | [invalid_api_key](https://qelka.com/docs/errors#invalid_api_key) | The key is missing, unknown or revoked |
| 402 | [insufficient_credits](https://qelka.com/docs/errors#insufficient_credits) | Your balance is less than 1 credit (live keys only) |
| 403 | [forbidden](https://qelka.com/docs/errors#forbidden) | The key is restricted to other endpoints |
| 405 | [invalid_request](https://qelka.com/docs/errors#invalid_request) | The method is not `POST` |
| 422 | [unprocessable_input](https://qelka.com/docs/errors#unprocessable_input) | `url` is not a page address, or its host is not public: an IP address, `localhost` or a private suffix |
| 429 | [rate_limited](https://qelka.com/docs/errors#rate_limited) | Too many requests: wait `Retry-After` seconds |
| 500 | [internal_error](https://qelka.com/docs/errors#internal_error) | Unexpected error on our side: retry with backoff |

No error is billed. A page that cannot be read is not an error: it is a `200` with a `status` other than `ok` and `credits_used: 0`.

## Related

- [Link in bio API](https://qelka.com/products/link-in-bio-lookup)
- Free tool: [link in bio lookup](https://qelka.com/tools/link-in-bio-lookup)
- [Website contacts](https://qelka.com/docs/api-reference/website): the emails, phones and social profiles a company site publishes
- [Batch](https://qelka.com/docs/api-reference/batch): up to 100 pages in one call, each item with `type: "link_in_bio"`
- [Bulk](https://qelka.com/docs/api-reference/bulk): a whole column of pages with `type=link_in_bio`
- [Caching](https://qelka.com/docs/caching), [Errors](https://qelka.com/docs/errors), [Test mode](https://qelka.com/docs/test-mode)
