Boards

Lists the boards a key can see.

POST /api/data/boards

Returns the boards owned by the account the key belongs to. There is no userId parameter — the key decides whose boards these are, which is what stops a key being pointed at somebody else's.

Parameters

NameTypeRequiredDescription
sharedbooleannotrue returns the boards shared with the account instead of the ones it owns. Defaults to false.
curl -X POST "https://boards.example.com/api/data/boards" \
  -H "X-API-Key: $LOKALBOARDS_KEY"
const response = await fetch("https://boards.example.com/api/data/boards", {
  headers: {
    "X-API-Key": apiKey,
  },
});

if (!response.ok) throw new Error(await response.text());

const data = await response.json();
<script setup>
const config = useRuntimeConfig();

const { data, error } = await useAsyncData("boards", () =>
  $fetch("https://boards.example.com/api/data/boards", {
    method: "POST",
    headers: { "X-API-Key": config.lokalBoardsKey },
  }),
);
</script>

<template>
  <pre v-if="data">{{ data }}</pre>
  <p v-else-if="error">{{ error.message }}</p>
</template>
import { useEffect, useState } from "react";

export function Example({ apiKey }) {
  const [data, setData] = useState(null);

  useEffect(() => {
    const controller = new AbortController();

    fetch("https://boards.example.com/api/data/boards", {
      method: "POST",
      headers: { "X-API-Key": apiKey },
      signal: controller.signal,
    })
      .then((response) => response.json())
      .then(setData)
      .catch((error) => {
        if (error.name !== "AbortError") console.error(error);
      });

    return () => controller.abort();
  }, [apiKey]);

  return <pre>{JSON.stringify(data, null, 2)}</pre>;
}
<?php

$ch = curl_init('https://boards.example.com/api/data/boards');

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'X-API-Key: ' . $apiKey,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);

Boards shared with you

curl -X POST "https://boards.example.com/api/data/boards" \
  -H "X-API-Key: $LOKALBOARDS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"shared": true}'
const response = await fetch("https://boards.example.com/api/data/boards", {
  headers: {
    "X-API-Key": apiKey,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    shared: true,
  }),
});

if (!response.ok) throw new Error(await response.text());

const data = await response.json();
<script setup>
const config = useRuntimeConfig();

const { data, error } = await useAsyncData("boards", () =>
  $fetch("https://boards.example.com/api/data/boards", {
    method: "POST",
    headers: { "X-API-Key": config.lokalBoardsKey },
    body: {
      shared: true,
    },
  }),
);
</script>

<template>
  <pre v-if="data">{{ data }}</pre>
  <p v-else-if="error">{{ error.message }}</p>
</template>
import { useEffect, useState } from "react";

export function Example({ apiKey }) {
  const [data, setData] = useState(null);

  useEffect(() => {
    const controller = new AbortController();

    fetch("https://boards.example.com/api/data/boards", {
      method: "POST",
      headers: {
        "X-API-Key": apiKey,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        shared: true,
      }),
      signal: controller.signal,
    })
      .then((response) => response.json())
      .then(setData)
      .catch((error) => {
        if (error.name !== "AbortError") console.error(error);
      });

    return () => controller.abort();
  }, [apiKey]);

  return <pre>{JSON.stringify(data, null, 2)}</pre>;
}
<?php

$ch = curl_init('https://boards.example.com/api/data/boards');

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'X-API-Key: ' . $apiKey,
    'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    'shared' => true,
]));

$response = json_decode(curl_exec($ch), true);
curl_close($ch);

Response

{
  "boards": [
    {
      "id": 456,
      "user": "8f3c1e2a-5b7d-4a91-9c8e-2d6f0b4a7e13",
      "name": "Product Roadmap",
      "style": "kanban",
      "image": "/images/board_placeholder_01.webp",
      "color": null,
      "status": "private"
    }
  ]
}

style is kanban or todo; status is private or public. A board carries either an image or a color, never both — see Boards for what that means on the dashboard.