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

# 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 %}
