# API

## Creating API Credentials

1. Open your user account settings.
2. Select "Personal Access Tokens"
3. Create a personal access token, giving it a name and time to expiry.
4. Copy the token to a safe place.

{% @storylane/embed subdomain="app" url="<https://app.storylane.io/share/m7gggisrxyam>" linkValue="m7gggisrxyam" %}

## GraphQL playground

1. Create a PAT from our Portal (top right corner your name > `Settings` > `Personal Tokens`)
2. Go to <https://api.app.gomboc.ai> to find our API playground
3. In the `Headers` section (bottom center), add:

```json
{
   "Authorization": "Bearer YOUR-TOKEN"
}
```

4. Now you can fetch the schema (lower left corner, `Refresh` button)
5. Next, use the left Explorer tool (top left corner, `Folder` button) to compose Queries or Mutations by selecting the fields that you care for
6. Execute your query (top right corner, `Play` button)

## Examples with `curl`

Get all the organization project names for the current user:

```bash
curl -X POST https://api.app.gomboc.ai/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR-TOKEN" \
  -d '{
    "query": "query MyQuery { organization { ... on Organization { name projects { name } } } }",
    "variables": {}
  }'
```

Link a repository to a project:

```bash
curl -X POST https://api.app.gomboc.ai/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR-TOKEN" \
  -d '{
    "query": "mutation MyMutation { linkRepositories(input: {projectId: \"\", providers: {gitProviderId: \"\", selectedRepositoryIds: \"\"}}) { ... on Link { id createdAt createdBy } ... on GombocError { code message } } }",
    "variables": {}
  }'
```

{% hint style="info" %}
Something missing? Looking for a particular feature? Please get in touch
{% endhint %}


---

# 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.gomboc.ai/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.
