Welcome to the Carto-Art developer API. This tutorial walks you from a fresh account to your first generated poster.
Prerequisites
- A Carto-Art account (free tier works for the examples below)
- Node.js 18 or later
- An API key from your developer dashboard
Install the SDK
npm install @kkingsbe/cartoart
Generate your first poster
import { CartoArtClient } from '@kkingsbe/cartoart';
const client = new CartoArtClient({
apiKey: process.env.CARTOART_API_KEY!,
});
const poster = await client.posters.generate({
location: { lat: 34.0522, lng: -118.2437 },
style: 'ivory-ink-paper-v2', // any palette ID from client.styles.list()
text: { title: 'LOS ANGELES', subtitle: 'California, USA' },
});
console.log('Poster ready:', poster.download_url);
Renders are synchronous by default and must finish inside the function limit
(120 seconds); flat street maps finish in 15-35 s at up to 2400x3600 px.
options.high_res is a legacy 2x shortcut that can be rejected with
422 render_too_large at large sizes — prefer output.pixelRatio (see
Output Formats). The returned
download_url is a permanent public object with no expiry and no delete API.
For large or 3D renders, pass async: true (or use the SDK's
generate(..., { wait: true }), submit() and wait() helpers): the API
returns 202 Accepted with a job id and poll_url, and you poll
GET /posters/{id} until the job is completed/failed/expired. See
Asynchronous rendering and
Dry runs for pricing a request
without rendering it.
Everything in the examples uses the www host
(https://www.cartoart.net/api/v1). The apex domain redirects cross-origin,
which drops the Authorization header.
What to read next
- Authentication — how API keys are issued and scoped.
- Styles and Palettes — pick the right look for your use case.