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

# The API credential object

An API credential object is returned as part of the response body of each successful create, list, retrieve or update API call to the `/api/api_credentials` endpoint.

## Fields

| Field                             | Type       | Description                                                                                                                                                                                         |
| --------------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`type`**                        | `string`   | `api_credentials`                                                                                                                                                                                   |
| **`id`**                          | `string`   | The API credential unique identifier.                                                                                                                                                               |
| links.**`self`**                  | `string`   | The API credential endpoint URL.                                                                                                                                                                    |
| attributes.**`name`**             | `string`   | The API credential internal name.                                                                                                                                                                   |
| attributes.**`kind`**             | `string`   | The API credential kind, can be one of: `webapp`, `sales_channel`, `integration` or the kind of app you want to fork (e.g. `orders`, `imports`, etc.).                                              |
| attributes.**`confidential`**     | `boolean`  | Indicates if the API credential it's confidential.                                                                                                                                                  |
| attributes.**`redirect_uri`**     | `string`   | The API credential redirect URI.                                                                                                                                                                    |
| attributes.**`client_id`**        | `string`   | The API credential unique ID.                                                                                                                                                                       |
| attributes.**`client_secret`**    | `string`   | The API credential unique secret.                                                                                                                                                                   |
| attributes.**`scopes`**           | `string`   | The API credential scopes.                                                                                                                                                                          |
| attributes.**`expires_in`**       | `integer`  | The lifetime of the access token in seconds (min. `7200`, max. `31536000`. Default is `14400` for Sales channels and `7200` for other client types).                                                |
| attributes.**`mode`**             | `string`   | Indicates the environment the resource belongs to (one of `test` or `live`).                                                                                                                        |
| attributes.**`custom`**           | `boolean`  | Indicates if the API credential is used to create a custom app (e.g. fork a hosted app).                                                                                                            |
| attributes.**`created_at`**       | `datetime` | Time at which the resource was created.                                                                                                                                                             |
| attributes.**`updated_at`**       | `datetime` | Time at which the resource was last updated.                                                                                                                                                        |
| attributes.**`reference`**        | `string`   | A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever. |
| attributes.**`reference_origin`** | `string`   | Any identifier of the third party system that defines the reference code.                                                                                                                           |
| attributes.**`metadata`**         | `object`   | Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.                                        |
| relationships.**`organization`**  | `object`   | The organization associated to the API credential.                                                                                                                                                  |
| relationships.**`role`**          | `object`   | The role associated to the API credential.                                                                                                                                                          |


---

# 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://docs.commercelayer.io/provisioning/api-reference/api_credentials/object.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.
