# Engage a firm

Source: https://amanucci.com/docs/developers/api/grants/createEngagement

## POST /v1/entities/{entityId}/engagements

Engage a firm

Start an engagement and seed the capabilities its profile agreed — one transaction, because an engagement without its grants grants nothing and grants without their engagement are a boundary with no agreement behind it. The approving owner must also REACH the entity (role ∧ head ∧ reach). The books hold one current engagement (`engagement_one_current`): a second, under a new id, is 409 `engagement_already_current`; a retry under the same id returns the first.

Operation ID: `createEngagement`

### 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/CreateEngagement"
      }
    }
  }
}
```

### Responses

#### 200 Duplicate-ok: this id already named an engagement on these books.

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

#### 201 The engagement, and exactly the capabilities its profile named.

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

#### 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"
    }
  }
}
```
