> For the complete documentation index, see [llms.txt](https://docs.cartesius.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cartesius.io/integrations/javascript-typescript.md).

# JavaScript/TypeScript

With the Cartesius Software-Development-Kit, you can quickly implement the Cartesius API into your web and backend application. To start, install the `@cartesius/sdk` node package.

```bash
  yarn add @cartesius/sdk # or
  npm i @cartesius/sdk
```

You can safely use this package in the browser or with Node.js. Bun and Deno should work as well, but are currently not supported. You can use the package in CommonJS and ESM environments.

```typescript
import { CartesiusClient } from "@cartesius/sdk" // ESM or
const { CartesiusClient } = require("@cartesius/sdk") // CJS

const client = new CartesiusClient({
  apiKey: '<YOUR-API-KEY>',
});

const result = await client.autocomplete("Freiheitsst", {
  languages: ["deu", "en"], // ISO 3166 ALPHA-2 or ALPHA-3
  fields: ["shape", "displayValue", "category"],
  // ...
})
```

As a result, you will receive `CartesiusApiResponse<CartesiusGeoFeature[]>` which is equivalent to the API response you would receive over HTTP.&#x20;

Each method is named after the REST endpoint of the API. The naming of the query parameters is also identical.

The package is **non-throwing**, every error will be represented as `CartesiusApiResponse`, which is equivalent to the API response you would receive over HTTP. Success is being indicated with the `status` property and the HTTP Status code `code`. If there has been an error with the request on the client side, the response will have the code -1. Check the messages for a detailed error descriptions.

###

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cartesius.io/integrations/javascript-typescript.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
