Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anytype API JavaScript Client

A pure JavaScript client for the Anytype API, generated from the OpenAPI specification.

Installation

Install via npm:

npm install anytype-client

Or using yarn:

yarn add anytype-client

Usage

Basic Setup

import { AnytypeClient } from 'anytype-client';

// Initialize the client
const client = new AnytypeClient({
  BASE: 'https://api.anytype.io',
  HEADERS: {
    'Authorization': 'Bearer YOUR_API_KEY'
  }
});

Examples

List Spaces

const spaces = await client.spaces.listSpaces();
console.log(spaces);

Create an Object

const newObject = await client.objects.createObject('space_id', {
  type_key: 'page',
  name: 'My New Page',
  body: 'This is the content of my page'
});
console.log(newObject);

List Objects in a Space

const objects = await client.objects.listObjects('space_id', '2025-11-08', 0, 100);
console.log(objects);

Search Objects

const searchResults = await client.search.searchObjectsWithinASpace('space_id', {
  query: 'search term',
  limit: 10
});
console.log(searchResults);

Update an Object

const updated = await client.objects.updateObject('space_id', 'object_id', {
  name: 'Updated Name',
  body: 'Updated content'
});
console.log(updated);

Available Services

The client includes the following services:

  • client.auth - Authentication (start challenge, retrieve token)
  • client.objects - Object management (create, read, update, delete, export)
  • client.spaces - Space management
  • client.lists - List/Set operations
  • client.types - Type management
  • client.templates - Template operations
  • client.tags - Tag management
  • client.properties - Property management
  • client.members - Member management
  • client.search - Search operations

Notes

  • All API calls return Promises
  • The client uses the Fetch API for HTTP requests
  • Error handling follows standard Promise rejection patterns

About

📦 JavaScript client for the Anytype API

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages