# Ask for a grant

Source: https://amanucci.com/fr/docs/developers/api/cases/requestGrant

## POST /v1/entities/{entityId}/grant-requests

Ask for a grant

The firm asks the client's owners for one capability on these books: one grant ask — no case, addressed to `owner`, answered through `answerGrantRequest`. Any firm seat reaching the entity through its engagement asks; no capability is needed, since asking for what the firm lacks is the point. A capability the firm holds is 409 `grant-already-held`; a second unanswered ask for it is 409 `grant-request-pending`. The client-minted id is the idempotency key.

Operation ID: `requestGrant`

### Parameters

```json
[
  {
    "schema": {
      "type": "string",
      "format": "uuid"
    },
    "required": true,
    "name": "entityId",
    "in": "path"
  }
]
```

### Request body

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/RequestGrant"
      }
    }
  }
}
```

### Responses

#### 200 Duplicate-ok: this id was asked.

```json
{
  "application/json": {
    "schema": {
      "$ref": "#/components/schemas/ClientRequest"
    }
  }
}
```

#### 201 The grant, asked.

```json
{
  "application/json": {
    "schema": {
      "$ref": "#/components/schemas/ClientRequest"
    }
  }
}
```

#### 401 Dead or absent credential (`unauthenticated`).

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```

#### 403 Authenticated, present, and refused: a missing grant, a missing seat, or a missing step-up.

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```

#### 404 Absent, or hidden from this asker — the two are indistinguishable (`not-found`).

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```

#### 409 The world is not in the state the request assumed: a stale `expectedSeq`, or a transition already made.

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```

#### 422 The request did not satisfy the schema (`invalid-input`).

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```

#### 429 Too many requests on this door's bucket (`rate-limited`); refused before any handler ran, `Retry-After` says when to come back.

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```

#### 503 Temporarily unavailable; `Retry-After` says when to come back.

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```
