> For the complete documentation index, see [llms.txt](https://support.goodaccess.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.goodaccess.com/configuration-guides/features/api-integration.md).

# API Integration

{% hint style="info" %}
This feature is available in the **Premium plan and higher**.
{% endhint %}

For more detailed API integration documentation, we recommend visiting the [Postman Documentation](https://documenter.getpostman.com/view/29070402/2sA3sAiTwM) or downloading the collection and importing it into Postman.

## Obtaining API token

[Log in to the GoodAccess **Control Panel**, and go to **Settings** > **API Integration**.](https://app.goodaccess.com/api-integration/)

Here, add a new integration or edit an existing one.

Select scopes of the integration, set expiration and allowed IP addresses, and generate a token.

Additionally, you can monitor the activity and communication of the integration from this interface.

<figure><img src="/files/A38ZbTdBRvTYeqmPaVQY" alt="API Integration detail."><figcaption><p>API Integration detail</p></figcaption></figure>

{% hint style="danger" %}
**Please note:** Immediately after being generated, you will see the token for a **limited period**. It is important to save the token in a secure place, as it provides access to the API and can be used to perform operations. After this period has expired, the token will be secured and you won’t be able to access it.
{% endhint %}

Your token can be used to authorize HTTP requests to the GoodAccess API. Each request must include an Authorization header with the token written as Bearer \<token>.

See the examples at the bottom of the page for correct syntax.

{% hint style="info" %}
Treat your token like a password and store it securely. For example, use the methods env and dotenv to store it in a development environment.
{% endhint %}

## Testing connection to GoodAccess API

To test your API connection, send an authenticated request to the test-connection endpoint. If the connection is successful, you will get a 200 return code.

## GET /api/v1/test-connection

> Test Connection

```json
{"openapi":"3.0.0","info":{"title":"GoodAccess Customer","version":"1.0.0"},"tags":[{"name":"Integrations"}],"servers":[{"url":"https://integration.goodaccess.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/api/v1/test-connection":{"get":{"tags":["Integrations"],"summary":"Test Connection","responses":{"200":{"description":"OK","headers":{"Content-Type":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object"}}}}}}}}}
```

Below are examples of how to call the test endpoint in various languages.

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

```bash
curl -i https://integration.goodaccess.com/api/v1/test-connection \
  -H "Authorization: Bearer <integration_token>"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'https://integration.goodaccess.com/api/v1/test-connection'
headers = {
    'Authorization': 'Bearer <integration_token>'
}

response = requests.get(url, headers=headers)
```

{% endtab %}

{% tab title="Node" %}

```javascript
const axios = require('axios');

const url = 'https://integration.goodaccess.com/api/v1/test-connection';
const token = '<integration_token>';

axios.get(url, {
  headers: {
    'Authorization': `Bearer ${token}`
  }
})
.then(response => {
 //...
})
.catch(error => {
  //...
});
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$url = 'https://integration.goodaccess.com/api/v1/test-connection';
$token = '<integration_token>';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Authorization: Bearer ' . $token,
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

curl_close($ch);
```

{% endtab %}
{% endtabs %}

## [API Reference](/configuration-guides/features/api-integration/api-reference.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://support.goodaccess.com/configuration-guides/features/api-integration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
