Skip to content

Quick Start

You’ll need a Comic Vine API key. Register for free at comicvine.gamespot.com/api.

import ComicVine from 'comic-vine-sdk';
const client = new ComicVine({ apiKey: 'your-api-key' });

Every resource has a retrieve() method that fetches a single item by ID:

// Get a specific issue
const issue = await client.issue.retrieve(1);
console.log(issue.name);
// Get a specific character
const character = await client.character.retrieve(1443);
console.log(character.name); // "Spider-Man"

Every resource has a list() method that returns paginated results:

const characters = await client.character.list({
filter: { name: 'Spider-Man' },
limit: 10,
});
console.log(characters.totalCount); // Total matching results
console.log(characters.results); // Array of characters

Reduce response size and get type-safe narrowing with fieldList:

const issue = await client.issue.retrieve(12345, {
fieldList: ['id', 'name', 'issueNumber', 'coverDate'],
});
console.log(issue.name); // string - available
console.log(issue.issueNumber); // number - available
// issue.description // TypeScript error - not selected

Add caching, deduplication, and rate limiting by installing store packages:

import ComicVine from 'comic-vine-sdk';
import {
InMemoryCacheStore,
InMemoryDedupeStore,
InMemoryRateLimitStore,
} from '@http-client-toolkit/store-memory';
const client = new ComicVine({
apiKey: 'your-api-key',
stores: {
cache: new InMemoryCacheStore({
maxItems: 1000,
}),
dedupe: new InMemoryDedupeStore(),
rateLimit: new InMemoryRateLimitStore({
defaultConfig: { limit: 100, windowMs: 60000 },
}),
},
});