Files
authentik/scripts/api-ts-templates
Teffen Ellis d86b5e7c8a web/packages: NPM workspace: Mini Cleanup (#14767)
* web: Move non-workspace package.

* web: Update ESBuild package version.

* web: Use NPM link to alias local package.

* web: Update lock.

* web: Fix regression where bundler is expected.
2025-06-26 17:29:35 -04:00
..

## @goauthentik/api

This package provides a generated API Client for [authentik](https://goauthentik.io?utm_source=npm-api-package).

### Building

See https://docs.goauthentik.io/docs/developer-docs/api/making-schema-changes#building-the-web-client

### Consuming

```
npm install @goauthentik/api --save
```

Create a configuration:

```typescript
import { Configuration } from "@goauthentik/api";

export const DEFAULT_CONFIG = new Configuration({
    // Configure where the API is located
    // Can be a full host, ensure CORS is configured
    basePath: "",
    // Required for POST/PUT/DELETE requests
    // getCookie function must return the cookie's contents
    headers: {
        "X-authentik-CSRF": getCookie("authentik_csrf"),
    },
});
```

Then use the API:

```typescript
import { CoreApi } from "@goauthentik/api";

const user = await new CoreApi(DEFAULT_CONFIG).coreUsersMeRetrieve();
```