# Sign a switch-in migration

Source: https://amanucci.com/docs/developers/api/migrations/signMigration

## POST /v1/firms/{firmId}/migrations/{migrationId}/sign

Sign a switch-in migration

Sign a company's move — ONE signed act, `post_entry`: a firm accountant (a staffer meets 403 `authority-required`) with a step-up under fifteen minutes old (403 `step-up-required`), and on a matched client also that client's signing (its `ledger.manage` grant). In one transaction: a new client's organisation, its entity named and addressed from the company (its enterprise and VAT numbers are attached when its invited owner accepts, never here), and its first owner's invite (`ownerEmail`, mailed after the commit; the engagement follows the owner's acceptance), the accounts, the parties, the year's periods and the opening's holder, the files copied into the entity's evidence, the signed opening, the migration `signed`; the year is then replayed in the background. A plan read before it changed or over another last filed period or replay cut-off (409 `plan_changed`), a plan with a blocker (409 `migration_blocked`, naming it), a new client without its owner (422 `owner_email_required`) or a migration already signed (409 `migration_signed`) writes nothing.

Operation ID: `signMigration`

### Parameters

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

### Request body

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

### Responses

#### 201 The company moved; the year replays in the background.

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

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