---
title: "Allow users with an active application grant to access a script."
method: PUT
path: "/api/v1/script/{script_id}/access/app"
---

# Allow users with an active application grant to access a script.

`PUT /api/v1/script/{script_id}/access/app`

## Request

- Base URL: `https://api.trends.earth/api/v1`
- URL: `https://api.trends.earth/api/v1/api/v1/script/{script_id}/access/app`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/trends/apis/trends-earth-api/docs/api/v1/script/:script_id/access/app/put.ts> (a function with typed inputs; its response is checked against the schema)

**Authentication**: JWT token required
**Authorization**: Admin level access required (ADMIN or SUPERADMIN)

**Request Schema**:
```json
{"app_key": "avoided_emissions"}
```

`app_key` must be a known gated application, or `null` to clear it.

**Behavior**:
- Additive: users with an active grant for `app_key` may access the script
  *in addition to* any existing role/user allowlists, which are unchanged.
- Does not change the script's `public` or `restricted` flags.

**Error Responses**:
- `400 Bad Request`: Missing or unknown `app_key`
- `401 Unauthorized`: JWT token required
- `403 Forbidden`: Admin privileges required
- `404 Not Found`: Script does not exist

## Path parameters

- `script_id` string, required

## Request body

- object

## Response `200`

Success

- object

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `500`: Internal Server Error

## Changes

- **2026-10-29** `0b75d1e065e1`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/trends/apis/trends-earth-api/changes/api/v1/script/:script_id/access/app/put.md)

---

[API](https://skmtc.dev/trends/apis/trends-earth-api.md) - [All operations](https://skmtc.dev/trends/apis/trends-earth-api/llms.txt) - [OpenAPI document](https://skmtc.dev/trends/apis/trends-earth-api/revisions/0b75d1e065e1?raw)
