# Migration sources

Source: https://www.pontive.com/docs/api-reference/management/migration-sources

Base URL: `https://api.{region}.pontive.com/v1` (operations that name another server say so).

Authentication: send `Authorization: Bearer <token>` with a secret key (`pontive_sk_…`, which implies its instance) or an access token issued for this API. A token that can reach several instances also names one with `X-Pontive-Instance-ID: inst_…`. Secret keys are for servers only.

## List migration sources

```http
GET https://api.{region}.pontive.com/v1/authn/migration-sources
```

The instance's migration sources, newest first. Needs sys:migration:read on the instance root, held by the instance's owners and admins only.

Operation ID: `ListMigrationSources`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `page` | integer |  | Page number |
| `limit` | integer |  | Items per page, 1 to 100 |

### Responses

- `200` OK: ListMigrationSourcesResponse
- `401` Unauthorized: ErrResponse
- `403` Forbidden: ErrResponse
- `500` Internal Server Error: ErrResponse

## Create migration source

```http
POST https://api.{region}.pontive.com/v1/authn/migration-sources
```

Register a system the instance's users are leaving (pontive-spec 46 §3): its name, its source_type (which picks defaults and the guide, and decides nothing on its own), and the parameters its password hashes need. A Firebase project's hashes need hash_config.firebase_scrypt: the signer key (base64, write-only: answered as a four-character preview), the salt separator (base64), rounds and mem_cost (1 to 16), from the Firebase console's password hash parameters. A source owns the legacy identities its imports write, by which a re-sent row matches the user it created. At most 10 per instance. Needs sys:migration:manage on the instance root, held by the instance's owners and admins only and never by a token acting for a user.

Operation ID: `CreateMigrationSource`

### Request body (`application/json`, required): CreateMigrationSourceRequest

Source

### Responses

- `201` Created: MigrationSource
- `400` Bad Request: ErrResponse
- `401` Unauthorized: ErrResponse
- `403` actor_refused: a token acting for a user cannot configure a migration source: ErrResponse
- `409` migration_source_limit: ErrResponse
- `500` Internal Server Error: ErrResponse

## Get migration source

```http
GET https://api.{region}.pontive.com/v1/authn/migration-sources/{migration_source_id}
```

The source, its signer key as a preview, and imported_passwords: how many users still sign in with a hash that needs it. Needs sys:migration:read on the instance root.

Operation ID: `GetMigrationSource`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `migration_source_id` | string | yes | Migration source ID (msrc_) |

### Responses

- `200` OK: MigrationSource
- `401` Unauthorized: ErrResponse
- `403` Forbidden: ErrResponse
- `404` migration_source_not_found: ErrResponse
- `500` Internal Server Error: ErrResponse

## Update migration source

```http
PATCH https://api.{region}.pontive.com/v1/authn/migration-sources/{migration_source_id}
```

Change the name, or replace hash_config whole: an omitted signer_key keeps the stored one, and {"firebase_scrypt": null} removes Firebase's parameters, refused migration_source_in_use while imported hashes still need them. Needs sys:migration:manage on the instance root.

Operation ID: `UpdateMigrationSource`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `migration_source_id` | string | yes | Migration source ID (msrc_) |

### Request body (`application/json`, required): UpdateMigrationSourceRequest

Changes

### Responses

- `200` OK: MigrationSource
- `400` Bad Request: ErrResponse
- `401` Unauthorized: ErrResponse
- `403` Forbidden: ErrResponse
- `404` migration_source_not_found: ErrResponse
- `409` migration_source_in_use: ErrResponse
- `500` Internal Server Error: ErrResponse

## Delete migration source

```http
DELETE https://api.{region}.pontive.com/v1/authn/migration-sources/{migration_source_id}
```

Delete the source with the legacy identities its imports wrote; runs keep their records. Refused migration_source_in_use while imported hashes still need its parameters. Needs sys:migration:manage on the instance root.

Operation ID: `DeleteMigrationSource`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `migration_source_id` | string | yes | Migration source ID (msrc_) |

### Responses

- `204` No Content
- `401` Unauthorized: ErrResponse
- `403` Forbidden: ErrResponse
- `404` migration_source_not_found: ErrResponse
- `409` migration_source_in_use: ErrResponse
- `500` Internal Server Error: ErrResponse

## Validate migration source

```http
POST https://api.{region}.pontive.com/v1/authn/migration-sources/{migration_source_id}/validate
```

Report problems without changing anything: whether the source has the parameters its type needs and, given firebase_scrypt_sample (a known Firebase user's password, password hash and salt), whether its Firebase parameters verify that user. Needs sys:migration:manage on the instance root.

Operation ID: `ValidateMigrationSource`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `migration_source_id` | string | yes | Migration source ID (msrc_) |

### Request body (`application/json`): ValidateMigrationSourceRequest

Sample

### Responses

- `200` OK: MigrationSourceValidation
- `401` Unauthorized: ErrResponse
- `403` Forbidden: ErrResponse
- `404` migration_source_not_found: ErrResponse
- `500` Internal Server Error: ErrResponse

## Schemas

### ListMigrationSourcesResponse

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | MigrationSource[] |  |  |
| `object` | string |  |  |
| `pagination` | Pagination |  | Pagination is the page answered (api-route-review D9). |

### ErrResponse

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | ErrBody |  |  |

### CreateMigrationSourceRequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `hash_config` | HashConfig |  |  |
| `name` | string |  |  |
| `source_type` | "auth0" \| "clerk" \| "supabase" \| "lovable_cloud" \| "firebase" \| "cognito" \| "nextauth" \| "better_auth" \| "replit_auth" \| "other" |  |  |

### MigrationSource

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `created_at` | string |  |  |
| `hash_config` | HashConfig |  |  |
| `id` | string |  |  |
| `imported_passwords` | integer |  | ImportedPasswords counts the users whose imported hash still needs this source: they have not signed in since. |
| `name` | string |  |  |
| `object` | string |  |  |
| `source_type` | "auth0" \| "clerk" \| "supabase" \| "lovable_cloud" \| "firebase" \| "cognito" \| "nextauth" \| "better_auth" \| "replit_auth" \| "other" |  |  |
| `updated_at` | string |  |  |

### UpdateMigrationSourceRequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `hash_config` | HashConfig |  |  |
| `name` | string |  |  |

### ValidateMigrationSourceRequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `firebase_scrypt_sample` | FirebaseScryptSample |  |  |

### MigrationSourceValidation

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checks` | MigrationSourceCheck[] |  |  |
| `object` | string |  |  |

### Pagination

Pagination is the page answered (api-route-review D9).

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | integer |  | Limit is the maximum number of items per page. |
| `page` | integer |  | Page is the 1-based index of the returned page. |
| `total` | integer |  | Total is the total number of items across all pages. |
| `total_pages` | integer |  | TotalPages is the total number of pages available. |

### ErrBody

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string |  | Code is the spec's machine-readable code for this error, in snake case: a domain code such as seat_limit_reached where the refusal has one, otherwise a generic one such as permission_denied, not_found, conflict, invalid_request or service_unavailable. |
| `details` | ErrDetail[] |  | Details are per-field findings, present only on a refusal that has them, e.g. a 422 invalid_theme names each invalid value by its path, a 422 package_invalid each problem, and a 409 capability_in_use each count by its name. |
| `doc_url` | string |  | DocURL links to documentation about this error, when available. |
| `message` | string |  | Message is a human-readable description of what went wrong. |
| `object` | string |  | Object is the discriminator; always "error". |
| `param` | string |  | Param names the request parameter this error refers to, when applicable. |
| `type` | "validation_error" \| "authentication_error" \| "authorization_error" \| "not_found" \| "conflict_error" \| "rate_limit_error" \| "internal_error" |  | Type is the error's category, set by its HTTP status: one of validation_error, authentication_error, authorization_error, not_found, conflict_error, rate_limit_error, internal_error. |

### HashConfig

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `firebase_scrypt` | FirebaseScrypt |  | FirebaseScrypt is null when the source has none. |

### FirebaseScryptSample

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `hash` | string |  |  |
| `password` | string |  |  |
| `salt` | string |  |  |

### MigrationSourceCheck

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `check` | string |  |  |
| `detail` | string |  |  |
| `status` | "ok" \| "failed" |  |  |

### ErrDetail

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `field` | string |  | Field is where the finding is: for a theme, its dotted path. |
| `message` | string |  | Message is what is wrong there. |

### FirebaseScrypt

FirebaseScrypt is null when the source has none.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `mem_cost` | integer |  | MemCost is 1 to 16. |
| `rounds` | integer |  | Rounds is 1 to 16. |
| `salt_separator` | string |  | SaltSeparator is base64. |
| `signer_key` | string |  | SignerKey is the base64 signer key. Write-only: never answered. |
| `signer_key_preview` | string |  | SignerKeyPreview is the signer key's last four characters, answered instead of it. |
