# Quickstart

{% stepper %}
{% step %}

### Getting started

All API endpoints are available under the following base URL:

```
https://api.safegpt.nl/v1/...
```

To use the SafeGPT API, you need an active [SafeGPT account](https://app.safegpt.nl/register). After your account has been created, you can authenticate your application in one of two ways:

1. **JWT token** — a long-lived access token for simple server-to-server integrations.
2. **OAuth 2.0** — a refresh-token flow with short-lived access tokens.

OAuth 2.0 is the recommended authentication method for production integrations. It provides better security because access tokens are short-lived and can be rotated using refresh tokens. API tokens are easier to implement, but should only be used in trusted backend environments.

> Never expose API tokens, client secrets, refresh tokens, or access tokens in frontend code, mobile apps, public repositories, or logs.
> {% endstep %}

{% step %}

### Choose an Authentication method

#### Option A: JWT token

Use an API token when your application runs in a trusted server-side environment and you want the simplest possible integration.

Typical use cases:

* Backend-to-backend integrations
* Internal services
* Scripts and automation
* Development and testing environments

With API token authentication, each request includes your token in the `Authorization` header:

```
Authorization: Bearer YOUR_API_TOKEN
```

You can create an Long-life access token by going to this direct link \[[https://app.safegpt.nl](https://app.safegpt.nl/account/apitokens/c6069b30-a950-42e5-8748-1e3f8ae332ec)] or login to SafeGPT, go to \[Settings] → \[API tokens].&#x20;

#### Option B: OAuth 2.0

Use OAuth 2.0 when you want stronger security, token rotation, or user-based authorization.

Typical use cases:

* Production applications
* Multi-user platforms
* SaaS integrations
* Applications where access should be revocable per user or workspace

OAuth 2.0 uses short-lived access tokens. When an access token expires, your application uses a refresh token to request a new access token.

```
Authorization: Bearer YOUR_API_TOKEN
```

{% endstep %}

{% step %}

### Authentication

All API requests must be authenticated using a bearer token. The token must be sent in the `Authorization` header.

```
Authorization: Bearer YOUR_API_TOKEN
```

The value of `<token>` depends on the authentication method you use:

* For API token authentication, use your long-lived API token.
* For OAuth 2.0 authentication, use the current short-lived access token.

Requests without a valid bearer token are rejected and returns into a 401 unauthorized.

{% endstep %}

{% step %}

### Make your first API request

After you have a valid token, you can make your first request to the SafeGPT API.

```
curl -X GET "https://api.safegpt.nl/v1/user/getcurrentuser" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Accept: application/json"
```

If you are unsure that you have a connection with our API, or if you want to monitor our system status, you may always call:

<mark style="color:green;">`GET`</mark>  /v1/safegpt/isalive

{% tabs %}
{% tab title="200" %}

```json
{
    "success":true,
    "statusCode":0,
    "message":"All SafeGPT systems are operational"
}
```

{% endtab %}
{% endtabs %}

This confirms that your token is valid and that your application can communicate with the SafeGPT API.
{% endstep %}
{% endstepper %}


---

# Agent Instructions: 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.safegpt.nl/api-en/get-started/quickstart.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.
