# Requesting Credit Action for Organization

This is a continuation of the "[Setting up an ICR app](/documentation/carbonregistry.com/api/apps/examples/setting-up-an-icr-app.md)" example.

### Update the App's Permissions

To update the permissions that the app requests access to we go back to the app's dashboard and into the "Permissions" tab

The additional permission we are looking for is the "Inventory - Read and request" permission. Choose that one. You'll be warned that this update will prompt admins of organizations that have your app installed to accept the new permissions before they are made available to your app.

<div><figure><img src="/files/elDVeP74bofeWH5yNJMj" alt=""><figcaption></figcaption></figure> <figure><img src="/files/TEFku4SVyfsXSOhsZysA" alt=""><figcaption></figcaption></figure></div>

For now save the update permissions. Then go to an organization you've installed your app on. In the "Installations" tab you'll see your app and the state of the permissions.&#x20;

<div><figure><img src="/files/YRruumsvnPcSNpLVMXoH" alt=""><figcaption></figcaption></figure> <figure><img src="/files/a93KIB1iYNf0COQBhxWk" alt=""><figcaption></figcaption></figure></div>

Review the update request and accept it. Now your app can read and request actions from that organization's inventory.

### Reading Organization's Inventory

Getting the inventory of the organization is simple ([docs](/documentation/carbonregistry.com/api/endpoints/v0.5/organizations.md#organizations-id-inventory-requests-action))

{% code fullWidth="false" %}

```typescript
const inv = await axios.get(
          `${env.ICR_API_URL}/organizations/${input.organizationId}/inventory`,
          {
            headers: {
              Authorization: `Bearer ${accessToken.token}`,
            },
          },
        );
```

{% endcode %}

Reference for this code [here](https://github.com/Mojoflower-garden/best-marketplace/blob/b6d497e12322b353003aeae7630f9d8804e5ff07/src/server/api/routers/icr.ts#L188).

### Requesting Transfer from Organization Inventory

This requires your app to have the "Inventory - Read and request" permission. If you need test credits see the [friendbot](/documentation/carbonregistry.com/api/endpoints/v0.5/organizations.md#friendbot-test-credits).

```typescript
const inv = await axios.get(
          `${env.ICR_API_URL}/organizations/${input.organizationId}/inventory/requests`,
          {
            headers: {
              Authorization: `Bearer ${accessToken.token}`,
            },
          },
        );
```

Reference for this code [here](https://github.com/Mojoflower-garden/best-marketplace/blob/b6d497e12322b353003aeae7630f9d8804e5ff07/src/server/api/routers/icr.ts#L115).

After having called this code the admin of the organization will be able to decide to accept or decline the request.

<figure><img src="/files/5G9hJN2gs3lEI6I2rZRn" alt=""><figcaption></figcaption></figure>

In this way an app can suggest actions, transfers, retirements for the organization to take based on some off-platform activity. This could, for example, be used by a marketplace that supports self custody of on chain credits (then it would request a transfer to some off ICR platform wallet address) or it could be used by a marketplace that requires the marketplace itself to hold the credits in their own organization inventory. Then the marketplace would request the transfer of these credits to their organization and keep their own internal accounting on who has claims to those credits.


---

# 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://documentation.carbonregistry.com/documentation/carbonregistry.com/api/apps/examples/requesting-credit-action-for-organization.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.
