# GraphQL API

## Introduction

Datacake is fully powered by a [GraphQL](https://graphql.org/) API, accessible at <https://api.datacake.co/graphql/>.

## Generate Access Token <a href="#authentication" id="authentication"></a>

To read or write any data, you need to authenticate with an access token. You can generate access tokens in your user settings.

See this guide on how to create access tokens:

{% content-ref url="/pages/-M3gMqrU93wYWQhlPZVy" %}
[Generate Access Token](/api/generate-access-token.md)
{% endcontent-ref %}

{% hint style="danger" %}
Note that **access tokens give access to your account**! Store them securely and do not share them with anyone.
{% endhint %}

You then have to pass this personal access token in the `Authorization` header as a token:

```
Authorization: Token <YOUR_TOKEN_HERE>
```

{% hint style="warning" %}
If you do not authorize correctly, your request will be treated as unauthenticated.
{% endhint %}

## Browse Documentation <a href="#documentation" id="documentation"></a>

For now, the only documentation for the API is exploring the schema with the **GraphiQL** at <https://api.datacake.co/graphql/> (click the "Docs" button on the upper right edge).

![](/files/-M3gV5gaFvBXlQrMk0ch)

## Authenticate

To authenticate in GraphiQL, paste your API token in the corresponding field at the top of the page:

![](https://gblobscdn.gitbook.com/assets%2F-LNA8_b8wmabHgJ0QXoJ%2F-M3fIsRDwztwcQDDmBqs%2F-M3fV77lIYYH3NYsn_W2%2Fimage.png?alt=media\&token=bc2b237c-06f9-47e7-b824-4797d3c274b2)

If you do not authorize correctly, your request will be treated as unauthenticated. The easiest way to check if you are authorized is to query for the authenticated user data:

```graphql
query {
    user {
        id
    }
}
```

If the returned user object is `null`, the request is not authenticated.

If you have any specific questions on how to achieve certain tasks, feel free to ping us directly at <support@datacake.de>, we would be happy to help!

## Usage Guide

{% content-ref url="/pages/-MYUr-Ie5HPjGYp2Mzl6" %}
[Using GraphQL](/api/graphql-api/using-graphql.md)
{% endcontent-ref %}


---

# 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.datacake.de/api/graphql-api.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.
