REST API

Fetch LinkFox sites over plain HTTP with the same parameter names as the front-end components.

Endpoint

GET https://linkfox.dev/api/rest/sites

Query parameters

NameRequiredDescription
slugYesRoot site slug
groupNoGroup slug filter
utm-keyNoQuery parameter key appended to output URLs
utm-valueNoQuery parameter value appended to output URLs
api-keyNoOptional. Send it when you want private access to your own site network

You can also pass the API key with:

  • x-api-key
  • Authorization: Bearer your-linkfox-api-key

Example request

const url = new URL('https://linkfox.dev/api/rest/sites');
url.searchParams.set('slug', 'game-father');
url.searchParams.set('group', 'game');
url.searchParams.set('utm-key', 'ref');
url.searchParams.set('utm-value', 'sidebar');

const response = await fetch(url);

const json = await response.json();
console.log(json.data.sites);

Response

{
  "code": 0,
  "message": "ok",
  "data": {
    "site": {
      "id": "site_123",
      "name": "Game Father",
      "slug": "game-father",
      "url": "https://gamefather.dev?ref=sidebar",
      "description": "Main site context"
    },
    "sites": [
      {
        "id": "site_456",
        "name": "Free Image Converter",
        "slug": "free-image-converter",
        "url": "https://img.gamefather.dev?ref=sidebar",
        "description": "Convert images in the browser",
        "faviconUrl": ""
      }
    ]
  }
}

If you do not send an API key, this API returns only public site networks. If you send an API key, LinkFox resolves the request against that key's owner and can return private network data as well.