{"id":18825,"library":"stoat-api","title":"Revolt API Client & Types","description":"The official JavaScript/TypeScript client library for the Revolt chat API (revolt-api). Current version 0.12.0 provides fully typed API request builder and TypeScript typings for all API objects. Ships with ESM and CommonJS support, includes built-in TypeScript declarations. Key differentiator: auto-generated from OpenAPI spec via @insertish/oapi, ensuring type safety for all endpoints and parameters. Developed by the Revolt team, follows semantic versioning.","status":"active","version":"0.12.0","language":"javascript","source_language":"en","source_url":"https://github.com/stoatchat/javascript-client-api","tags":["javascript","typescript"],"install":[{"cmd":"npm install stoat-api","lang":"bash","label":"npm"},{"cmd":"yarn add stoat-api","lang":"bash","label":"yarn"},{"cmd":"pnpm add stoat-api","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Underlying API client generator","package":"@insertish/oapi","optional":true}],"imports":[{"note":"Named export, not default. ESM/CJS compatible.","wrong":"import API from 'revolt-api'","symbol":"API","correct":"import { API } from 'revolt-api'"},{"note":"Type-only export; use 'import type' in TypeScript to avoid emitting runtime code.","wrong":"import { User } from 'revolt-api'","symbol":"User","correct":"import type { User } from 'revolt-api'"},{"note":"No default export exists; the package exports named symbols only. Use destructured require.","wrong":"const RevoltAPI = require('revolt-api')","symbol":"default export","correct":"import { API } from 'revolt-api'"}],"quickstart":{"code":"import { API } from 'revolt-api';\n\nconst client = new API({ authentication: { revolt: process.env.REVOLT_TOKEN ?? '' } });\n\n// Fetch the current user\nclient.get('/users/@me')\n  .then(user => {\n    console.log(`Hello ${user.username}`);\n  })\n  .catch(err => console.error('Error:', err));\n\n// Send a message\nclient.post('/channels/some_channel_id/messages', {\n  content: 'Hello from stoat-api!'\n}).then(msg => console.log('Message sent:', msg.id));","lang":"typescript","description":"Shows initialization with optional authentication, fetching current user, and posting a message with full TypeScript types."},"warnings":[{"fix":"Use const { API } = require('revolt-api') instead of const API = require('revolt-api')","message":"When using CommonJS (require), you must destructure the import: const { API } = require('revolt-api')","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pass { authentication: { revolt: 'your-token' } } to the API constructor","message":"Authentication object expects property 'revolt' with the bot token, not 'token' or 'bot'","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"client.delete('/channels/some-id') works fine without a second argument","message":"Posting to endpoints that require no body (e.g., DELETE /channels/:id) still expects second argument, but you can omit it","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use complementary packages like revolt.js for full bot development","message":"The package exports only types and API class; there is no message builder or WebSocket client included","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.12.0':20 'api':2,14,17,24,32 'auto':49 'auto-gener':48 'builder':26 'built':42 'built-in':41 'chat':13 'client':3,8 'commonj':38 'current':18 'declar':45 'develop':64 'differenti':47 'endpoint':61 'ensur':56 'esm':36 'follow':69 'fulli':22 'generat':50 'includ':40 'insertish/oapi':55 'javascript':72 'javascript/typescript':7 'key':46 'librari':9 'object':33 'offici':6 'openapi':52 'paramet':63 'provid':21 'request':25 'revolt':1,12,16,67 'revolt-api':15 'safeti':58 'semant':70 'ship':34 'spec':53 'support':39 'team':68 'type':4,23,29,57 'typescript':28,44,73 'version':19,71 'via':54","created_at":"2026-04-25T07:40:19.842511+00:00","updated_at":"2026-04-25T07:40:19.842511+00:00","problems":[{"fix":"Install the package: npm install revolt-api","cause":"Package not installed or incorrect import path","error":"Error: Cannot find module 'revolt-api'"},{"fix":"Ensure correct import: import { API } from 'revolt-api'","cause":"Imported incorrectly (e.g., default import instead of named import)","error":"TypeError: client.get is not a function"},{"fix":"Import type { User } from 'revolt-api' and use it explicitly: const user: User = await client.get('/users/@me')","cause":"Missing TypeScript type for User or improper type handling","error":"Property 'username' does not exist on type 'unknown'"},{"fix":"Check that REVOLT_TOKEN is set correctly and the API URL is reachable","cause":"Invalid token or network error","error":"TypeError: Failed to fetch"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":"https://revolt.chat","github":"https://github.com/stoatchat/javascript-client-api","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/stoat-api","openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","type-stubs","communication"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}