@kapable/sdk (0.1.0)

Published 2026-05-20 10:32:30 +00:00 by kapable

Installation

@kapable:registry=
npm install @kapable/sdk@0.1.0
"@kapable/sdk": "0.1.0"

About this package

@kapable/sdk

TypeScript SDK for the Kapable v2 API. Fetch-based, works in Node, Bun, Deno, and browsers.

Install

bun add @kapable/sdk
# or
npm install @kapable/sdk

Quick Start

import { KapableClient } from '@kapable/sdk';

const client = new KapableClient({
  baseUrl: 'https://api.kapable.ai',
  apiKey: 'sk_live_...',
});

// List active stories
const stories = await client.board.listStories({ status: 'active' });
console.log(`${stories.total} stories found`);

// Auto-paginate through all stories
for await (const story of client.board.paginateStories({ status: 'active' })) {
  console.log(story.title);
}

// Create a story
const story = await client.board.createStory({
  title: 'Implement login flow',
  priority: 'high',
  product_id: 'product-uuid',
});

// Upload a file
await client.store.uploadObject(
  'uploads',
  'reports/q3.pdf',
  fileBytes,
  'application/pdf',
);

// Get a presigned download URL
const presign = await client.store.presignDownload('uploads', 'reports/q3.pdf');
console.log(presign.url);

Authentication

// API key (sent as x-api-key header)
const client = new KapableClient({
  baseUrl: 'https://api.kapable.ai',
  apiKey: 'sk_live_...',
});

// JWT token (sent as Authorization: Bearer header)
const client = new KapableClient({
  baseUrl: 'https://api.kapable.ai',
  token: 'jwt_token_here',
});

Error Handling

All API errors throw KapableError with code, message, and status fields matching the standard error envelope:

import { KapableError } from '@kapable/sdk';

try {
  await client.board.getStory('nonexistent');
} catch (err) {
  if (err instanceof KapableError) {
    console.log(err.status);  // 404
    console.log(err.code);    // "NOT_FOUND"
    console.log(err.message); // "story not found"
  }
}

Modules

Board

Stories, sprints, plans, products, comments, closures.

// Stories
client.board.listStories(params?)
client.board.paginateStories(params?, pageSize?)
client.board.getStory(idOrCode)
client.board.createStory(req)
client.board.updateStory(idOrCode, req)
client.board.deleteStory(idOrCode)
client.board.transitionStory(idOrCode, req)

// Sprints
client.board.listSprints(params?)
client.board.getSprint(idOrCode)
client.board.createSprint(req)
client.board.startSprint(idOrCode)
client.board.completeSprint(idOrCode)
client.board.attachStory(sprintIdOrCode, req)
client.board.detachStory(sprintIdOrCode, storyId)

// Sprint Closures
client.board.getClosure(sprintIdOrCode)
client.board.upsertClosure(sprintIdOrCode, req)

// Plans
client.board.listPlans(params?)
client.board.getPlan(idOrCode)
client.board.createPlan(req)
client.board.updatePlan(idOrCode, req)
client.board.listRevisions(planIdOrCode)
client.board.createRevision(planIdOrCode, req)

// Products
client.board.listProducts()
client.board.getProduct(slugOrId)
client.board.createProduct(req)
client.board.updateProduct(slugOrId, req)

// Comments
client.board.listComments(params)
client.board.createComment(req)
client.board.updateComment(id, req)
client.board.deleteComment(id)

Store

Buckets, objects, presigned URLs.

// Buckets
client.store.listBuckets()
client.store.createBucket(req)

// Objects
client.store.listObjects(bucket, params?)
client.store.paginateObjects(bucket, params?)
client.store.uploadObject(bucket, key, body, contentType?)
client.store.downloadObject(bucket, key)
client.store.deleteObject(bucket, key)

// Presigned URLs
client.store.presignUpload(bucket, key, params?)
client.store.presignDownload(bucket, key, params?)

Tree-Shakeable Imports

// Import only the board module
import { BoardClient } from '@kapable/sdk/board';
import type { Story, Sprint } from '@kapable/sdk/board';

// Import only the store module
import { StoreClient } from '@kapable/sdk/store';
import type { Bucket, ObjectInfo } from '@kapable/sdk/store';

Dependencies

Development dependencies

ID Version
@types/bun ^1.2.0
typescript ^5.7.0
Details
npm
2026-05-20 10:32:30 +00:00
0
MIT
latest
40 KiB
Assets (1)
sdk-0.1.0.tgz 40 KiB
Versions (1) View all
0.1.0 2026-05-20