API Reference

The recommended way to interact with the Cosmic API is by using one of our official SDKs. Today, Cosmic offers a REST API and JavaScript SDK to give you the best experience when consuming the API.

API base URL

The base URL for all requests is noted below.

Base URL

http://api.cosmicjs.com

API status

You can check the API status at the following endpoint. You can also subscribe to status updates on the Cosmic status page.

Status endpoint

http://api.cosmicjs.com/v3/status

Install the Cosmic JavaScript SDK

The following examples include methods using the Cosmic JavaScript SDK. To run the examples, first install the NPM module using one of the following commands. Make sure you have Node.js installed on your machine (recomended version: v18.*).

Install the Cosmic JavaScript SDK

yarn add @cosmicjs/sdk
# OR
pnpm add @cosmicjs/sdk
# OR
npm install @cosmicjs/sdk

Install the Swift SDK

In certain cases, there are also methods that use the Cosmic Swift SDK. To run the examples, first install the Swift package using Swift Package Manager.

Install the Cosmic Swift SDK

.package(url: "https://github.com/cosmicjs/cosmic-sdk-swift.git", from: "1.0.0")