CAPI is a Compressed NFT (cNFT) API as a service that provides APIs to mint compressed NFTs (cNFT).
CAPI takes in your collection details and NFT details and mints them to the provided addresses. You don't have to worry about the complexities of Merkle trees, Gas, or the chain in any sense. All you have to do is call the CAPI API.
CAPI stores your images, creates metadata for collection and images, stores the metadata JSON files, creates merkle tree and collection and mints the cNFTs.
CAPI uses the Helius DAS API to provide you with fast access to your minted cNFTs. Additionally, CAPI stores data about your mints to provide you with tracking and other desired usability features.
Mint Collection
capi-demo-compressed.mp4
List Collection Items
list-demo.mp4
/user/create
: Creates a new CAPI user in DB. Call this after authentication
Type: POST
Body:
string | User email | |
Returns:
userId | int | User Id |
/auth/key/new
: Creates a new API key for CAPI
Type: POST
Body: None
Returns:
key | string | CAPI API Key |
/nft/mint
: Mint NFT Collection
Type: POST
Header: Authorization Bearer <API KEY>
Body:
Example
{
"collection": {
"nftCount": 10,
"mintAllTo": "someDaddyAddress",
"collectionName": "Never gonna let you go",
"collectionSymbol": "CAPI",
"collectionImage": "ImageBase64"
},
"nft": [
{
"name": "Rickroll",
"symbol": "Drums",
"description": "Minted via Capi",
"receiver": null,
"image": "ImageBase64"
},
{
"name": "Ping Pong",
"symbol": "SomeSymbol",
"description": "Your Hackathon Prize",
"receiver": "SomeAddress",
"image": "ImageBase64"
}
]
}
Params Explained:
All params are required
collection
:
nftCount
: int: Count of total cNFTs to mintmintAllTo
: Default address to mint all cNFTs tocollectionName
: Collection NamecollectionSymbol
: Collection SymbolcollectionImage
: Collection image in base64 encoding
nft
: List of:
name
: cNFT NameSymbol
: cNFT Symboldescription
: Description of cNFTreceiver
: Receiver Address. nullableimage
: cNFT Image
Returns:
signatures
: string[]: Mint transactionscollectionMint
: string: Collection Mint
/nft/list/:collectionMint?page=1&pageSize=10
: Get a list of all NFTs minted in a collection
Type: GET
Header: Authorization Bearer <API KEY>
Params:
collectionMint
: The collection mint returned after mintingpage
: Page index for paginated responsepageSize
: Page size
PORT
: Server PortSUPABASE_URL
: Supabase URLSUPABASE_ANON_KEY
: Supabase Anon KeyNODE_ENV
: Node evn, Eg.production
,staging
,development
HELIUS_KEY
: Helius API KeyUNKEY_KEY
: Unkey admin keyUNKEY_API_ID
: Unkey API id
Here's the SQL for creating tables:
Supabase Postgres
CREATE TABLE "users" (
"user_id" varchar(26) PRIMARY KEY NOT NULL,
"email" varchar UNIQUE NOT NULL,
"key_id" text,
"user_status" integer DEFAULT 0
);
CREATE TABLE "collection" (
"collection_id" INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY NOT NULL,
"user_id" varchar(26) NOT NULL,
"name" text NOT NULL,
"symbol" text NOT NULL,
"image_url" text NOT NULL,
"uri_url" text NOT NULL,
"mint" text,
"token_account" text,
"metadata_account" text,
"master_edition_account" text,
"seller_fee_basis_points" integer DEFAULT 100,
"creators" creator_info[],
"collection" text,
"uses" text,
"mutable" bool DEFAULT true,
"collection_details" text
);
CREATE TABLE "tree" (
"tree_id" integer PRIMARY KEY NOT NULL,
"collection_id" integer NOT NULL,
"max_depth" integer DEFAULT 3,
"canopy_depth" integer DEFAULT 3,
"payer" text NOT NULL,
"storage_cost" integer,
"keypair" integer
);
CREATE TABLE "keypair" (
"keypair_id" INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY NOT NULL,
"public_key" text NOT NULL,
"secret_key" text NOT NULL,
"keypair_type" integer NOT NULL DEFAULT 0
);
CREATE TABLE "mints" (
"mint_id" INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
"user_id" varchar(26),
"collection_id" integer NOT NULL,
"transaction_signatures" text[]
);
COMMENT ON COLUMN "users"."user_id" IS 'A valid ULID';
COMMENT ON COLUMN "users"."user_status" IS 'status of user. Valid status values are:
1. created,
2. active,
3. upgraded,
4. inactive,
5. blocked,
6. services disabled (eg. free tier expired),
7. pending actions (eg. not paid fees)';
ALTER TABLE "collection" ADD FOREIGN KEY ("user_id") REFERENCES "users" ("user_id");
ALTER TABLE "tree" ADD FOREIGN KEY ("collection_id") REFERENCES "collection" ("collection_id");
ALTER TABLE "tree" ADD FOREIGN KEY ("keypair") REFERENCES "keypair" ("keypair_id");
ALTER TABLE "mints" ADD FOREIGN KEY ("user_id") REFERENCES "users" ("user_id");
ALTER TABLE "mints" ADD FOREIGN KEY ("collection_id") REFERENCES "collection" ("collection_id");
- Express-TypeScript
- Supabase DB & Storage
- Bubblegum Protocol
- Metaplex SDK
- Helius DAS API
-
Where are metadata files stored?
Metadata JSON and image files are stored in Supabase storage and their public URLs are used while minting. -
Why is Supabase DB used?
Metadata like collection info, tree info, mint into, transaction signatures and, more are stored in the relational database. See the schema in the next section. -
What is the use of Unkey?
Unkey is an open-source API key management platform used to provision and manage CAPI API keys with features like on-the-edge rate limiting and more. -
How are cNFTs minted? cNFTs are minted using the Bubblegum protocol by Metaplex Foundation.
-
Who pays for the gas for minting?
cAPI as a service takes care of the gas and other costs. This enables sponsored/funded minting of cNFTs. -
What is the use of Helius?
Helius' DAS API is used to fetch cNFT information. The service is fast and efficient.