Area

One area: create it, rename it, delete it.

POST /api/data/area

Creates an area, or renames one when id is given.

Parameters

NameTypeRequiredDescription
idintegernoPresent means rename, absent means create.
boardIdintegeryesThe board it belongs to.
namestringyesThe area's name.
curl -X POST "https://boards.example.com/api/data/area" \
  -H "X-API-Key: $LOKALBOARDS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"boardId": 123, "name": "In Review"}'
const response = await fetch("https://boards.example.com/api/data/area", {
  method: "POST",
  headers: {
    "X-API-Key": apiKey,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    boardId: 123,
    name: "In Review",
  }),
});

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

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

async function saveArea() {
  pending.value = true;
  try {
    return await $fetch("https://boards.example.com/api/data/area", {
      method: "POST",
      headers: { "X-API-Key": config.lokalBoardsKey },
      body: {
        boardId: 123,
        name: "In Review",
      },
    });
  } finally {
    pending.value = false;
  }
}
</script>

<template>
  <button :disabled="pending" @click="saveArea()">Save area</button>
</template>
import { useState } from "react";

export function Example({ apiKey }) {
  const [pending, setPending] = useState(false);

  async function saveArea() {
    setPending(true);

    const response = await fetch("https://boards.example.com/api/data/area", {
      method: "POST",
      headers: {
        "X-API-Key": apiKey,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        boardId: 123,
        name: "In Review",
      }),
    });

    setPending(false);
    return response.json();
  }

  return (
    <button disabled={pending} onClick={saveArea}>
      Save area
    </button>
  );
}
<?php

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

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
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([
    'boardId' => 123,
    'name' => "In Review",
]));

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

DELETE /api/data/area

Archives an area and the cards in it. The cards are not themselves marked — they come back exactly as they were when the area is restored.

This archives rather than deletes. Since v0.36.0 the row stays, everything hanging off it stays, and it disappears from every list — the board, the dashboard, search and the reminders — until it is restored. Pass permanent for the old, irreversible behaviour.

Parameters

NameTypeRequiredDescription
idintegeryesThe area's id.
boardIdintegeryesThe board it belongs to.
permanentbooleannotrue deletes the area and every card in it outright. Not reversible.
curl -X DELETE "https://boards.example.com/api/data/area?id=12&boardId=123" \
  -H "X-API-Key: $LOKALBOARDS_KEY"
const response = await fetch("https://boards.example.com/api/data/area?id=12&boardId=123", {
  method: "DELETE",
  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 pending = ref(false);

async function deleteArea() {
  pending.value = true;
  try {
    return await $fetch("https://boards.example.com/api/data/area?id=12&boardId=123", {
      method: "DELETE",
      headers: { "X-API-Key": config.lokalBoardsKey },
    });
  } finally {
    pending.value = false;
  }
}
</script>

<template>
  <button :disabled="pending" @click="deleteArea()">Delete area</button>
</template>
import { useState } from "react";

export function Example({ apiKey }) {
  const [pending, setPending] = useState(false);

  async function deleteArea() {
    setPending(true);

    const response = await fetch("https://boards.example.com/api/data/area?id=12&boardId=123", {
      method: "DELETE",
      headers: {
        "X-API-Key": apiKey,
      },
    });

    setPending(false);
    return response.json();
  }

  return (
    <button disabled={pending} onClick={deleteArea}>
      Delete area
    </button>
  );
}
<?php

$ch = curl_init('https://boards.example.com/api/data/area?id=12&boardId=123');

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
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);