# pub.techne.draft.commons.grantProviderAllowance

> Grant an allowance of paid provider (Jev, or Claude for venue research and the short line) calls beyond a daily cap, for an intentional batch (a backfill), valid until `expiresAt`, with a required reason. Recorded on the rules runner under the caller's DID: only an operator's DID may grant, never the shared token (refused with Forbidden); the daily cap stays the runaway-loop guard and nothing else raises it. Calls past the cap are reserved from live grants, oldest expiry first; a grant that expires or is used up stops adding. Forwarded to the runner's POST /v1/provider/grants. Operator only. The credential is `Authorization: Bearer <credential>`: an atproto service-auth JWT signed by a DID the commons root names as an operator (a pub.techne.draft.operator record; `aud` = the Commons API's service-account DID, not the commons root's, `lxm` = this method), or the Commons API's APICOOP_OPERATOR_TOKEN. Without one the call is refused with AuthRequired; with one that is not an operator's, Forbidden; when the Commons API can check neither, NotConfigured. Typed to confirm: the call needs `confirm` = `calls` in digits (see `confirm`), or it is refused with ConfirmationRequired.

- Kind: procedure
- Authority: commons.draft.techne.pub
- Lexicon: 1
- Published by [lexicons.techne.town](https://lexicon.garden/identity/did:plc:cbtfheqpi4g6vlrha4tpoh53), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:cbtfheqpi4g6vlrha4tpoh53/pub.techne.draft.commons.grantProviderAllowance)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:cbtfheqpi4g6vlrha4tpoh53/pub.techne.draft.commons.grantProviderAllowance/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:cbtfheqpi4g6vlrha4tpoh53/pub.techne.draft.commons.grantProviderAllowance/analytics)

## Procedure (`pub.techne.draft.commons.grantProviderAllowance`)

Type: procedure · POST

### Input (application/json)

- `budget` (string): Which daily budget it extends; `shared` when absent.
  - Constraints: default: "shared", knownValues: shared | own | research | summary
- `calls` (integer, required): Calls granted.
  - Constraints: minimum: 1, maximum: 1000000
- `confirm` (string): `calls` typed again, in digits (`3000`, not `3,000` or `03000`). Byte for byte: same case, no added spaces. The call is refused with ConfirmationRequired before it does anything when this is missing or does not match.
  - Constraints: maxLength: 1000
- `expiresAt` (string · datetime, required): When the grant stops adding, at most 31 days ahead.
- `reason` (string, required): Why (required): e.g. the cutover backfill.
  - Constraints: maxLength: 1000

### Output (application/json)

- `grant` (ref, required)
  - Reference: `pub.techne.draft.commons.defs#providerGrantView`

### Errors

- `InvalidRequest`: No description in schema.
- `ConfirmationRequired`: `confirm` is missing or is not exactly what this action is confirmed with (see `confirm`). Nothing was done.
- `UpstreamFailed`: No description in schema.
- `AuthRequired`: No description in schema.
- `Forbidden`: No description in schema.
- `NotConfigured`: No description in schema.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Grant an allowance of paid provider (Jev, or Claude for venue research and the short line) calls beyond a daily cap, for an intentional batch (a backfill), valid until `expiresAt`, with a required reason. Recorded on the rules runner under the caller's DID: only an operator's DID may grant, never the shared token (refused with Forbidden); the daily cap stays the runaway-loop guard and nothing else raises it. Calls past the cap are reserved from live grants, oldest expiry first; a grant that expires or is used up stops adding. Forwarded to the runner's POST /v1/provider/grants. Operator only. The credential is `Authorization: Bearer <credential>`: an atproto service-auth JWT signed by a DID the commons root names as an operator (a pub.techne.draft.operator record; `aud` = the Commons API's service-account DID, not the commons root's, `lxm` = this method), or the Commons API's APICOOP_OPERATOR_TOKEN. Without one the call is refused with AuthRequired; with one that is not an operator's, Forbidden; when the Commons API can check neither, NotConfigured. Typed to confirm: the call needs `confirm` = `calls` in digits (see `confirm`), or it is refused with ConfirmationRequired.",
      "errors": [
        {
          "name": "InvalidRequest"
        },
        {
          "description": "`confirm` is missing or is not exactly what this action is confirmed with (see `confirm`). Nothing was done.",
          "name": "ConfirmationRequired"
        },
        {
          "name": "UpstreamFailed"
        },
        {
          "name": "AuthRequired"
        },
        {
          "name": "Forbidden"
        },
        {
          "name": "NotConfigured"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "budget": {
              "default": "shared",
              "description": "Which daily budget it extends; `shared` when absent.",
              "knownValues": [
                "shared",
                "own",
                "research",
                "summary"
              ],
              "type": "string"
            },
            "calls": {
              "description": "Calls granted.",
              "maximum": 1000000,
              "minimum": 1,
              "type": "integer"
            },
            "confirm": {
              "description": "`calls` typed again, in digits (`3000`, not `3,000` or `03000`). Byte for byte: same case, no added spaces. The call is refused with ConfirmationRequired before it does anything when this is missing or does not match.",
              "maxLength": 1000,
              "type": "string"
            },
            "expiresAt": {
              "description": "When the grant stops adding, at most 31 days ahead.",
              "format": "datetime",
              "type": "string"
            },
            "reason": {
              "description": "Why (required): e.g. the cutover backfill.",
              "maxLength": 1000,
              "type": "string"
            }
          },
          "required": [
            "calls",
            "expiresAt",
            "reason"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "grant": {
              "ref": "pub.techne.draft.commons.defs#providerGrantView",
              "type": "ref"
            }
          },
          "required": [
            "grant"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "pub.techne.draft.commons.grantProviderAllowance",
  "lexicon": 1
}
```
