# social.colibri.community.migrate

> Published by [colibri.social](https://lexicon.garden/identity/did:plc:mprdjqjluoswa7awzggaggj3)

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:mprdjqjluoswa7awzggaggj3/social.colibri.community.migrate)
- [Documentation](https://lexicon.garden/lexicon/did:plc:mprdjqjluoswa7awzggaggj3/social.colibri.community.migrate/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:mprdjqjluoswa7awzggaggj3/social.colibri.community.migrate/examples)

## Definitions

### `social.colibri.community.migrate`

**Type**: `procedure`

Migrates a source record into a fresh community, cloning its structure and importing its members. The 'kind' discriminator selects the migration; today only legacy communities are supported, but the endpoint is designed to host future migrations. Provisioning mirrors community.create (managed when no PDS credentials are supplied, bring-your-own otherwise).

#### Input

**Encoding**: `multipart/form-data`

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `did` | `string` (did) | Yes |  |
| `community` | `string` (at-uri) | Yes |  |
| `channelMap` | `array` | Yes | Maps each cloned channel from its old AT-URI to its new AT-URI. |

#### Errors

- **AuthRequired**: Missing, malformed, or unverifiable service auth.
- **Forbidden**: The caller lacks the permission this method requires.
- **InvalidRequest**: A parameter or body field was missing or malformed.
- **NotFound**: The referenced record does not exist.
- **UpstreamFailure**: A service outside this AppView failed.

### `social.colibri.community.migrate#channelMapping`

**Type**: `object`

A single channel's old AT-URI mapped to its new AT-URI.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `new` | `string` (at-uri) | Yes |  |
| `old` | `string` (at-uri) | Yes |  |

## Raw Schema

```json
{
  "id": "social.colibri.community.migrate",
  "defs": {
    "main": {
      "type": "procedure",
      "input": {
        "encoding": "multipart/form-data",
        "description": "Optional replacement community picture blob, as a `picture` part. Migrated communities have no banner."
      },
      "errors": [
        {
          "name": "AuthRequired",
          "description": "Missing, malformed, or unverifiable service auth."
        },
        {
          "name": "Forbidden",
          "description": "The caller lacks the permission this method requires."
        },
        {
          "name": "InvalidRequest",
          "description": "A parameter or body field was missing or malformed."
        },
        {
          "name": "NotFound",
          "description": "The referenced record does not exist."
        },
        {
          "name": "UpstreamFailure",
          "description": "A service outside this AppView failed."
        }
      ],
      "output": {
        "schema": {
          "type": "object",
          "required": [
            "did",
            "community",
            "channelMap"
          ],
          "properties": {
            "did": {
              "type": "string",
              "format": "did"
            },
            "community": {
              "type": "string",
              "format": "at-uri"
            },
            "channelMap": {
              "type": "array",
              "items": {
                "ref": "lex:social.colibri.community.migrate#channelMapping",
                "type": "ref"
              },
              "description": "Maps each cloned channel from its old AT-URI to its new AT-URI."
            }
          }
        },
        "encoding": "application/json"
      },
      "parameters": {
        "type": "params",
        "required": [
          "kind",
          "source"
        ],
        "properties": {
          "pds": {
            "type": "string",
            "description": "Bring-your-own PDS endpoint."
          },
          "kind": {
            "type": "string",
            "description": "The migration to run. 'legacy-community' migrates a pre-rework community record.",
            "knownValues": [
              "legacy-community"
            ]
          },
          "name": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "format": "at-uri",
            "description": "The record being migrated (e.g. the legacy community)."
          },
          "password": {
            "type": "string",
            "description": "Bring-your-own account password."
          },
          "identifier": {
            "type": "string",
            "description": "Bring-your-own DID or handle."
          },
          "description": {
            "type": "string"
          },
          "requiresApprovalToJoin": {
            "type": "boolean"
          }
        }
      },
      "description": "Migrates a source record into a fresh community, cloning its structure and importing its members. The 'kind' discriminator selects the migration; today only legacy communities are supported, but the endpoint is designed to host future migrations. Provisioning mirrors community.create (managed when no PDS credentials are supplied, bring-your-own otherwise)."
    },
    "channelMapping": {
      "type": "object",
      "required": [
        "old",
        "new"
      ],
      "properties": {
        "new": {
          "type": "string",
          "format": "at-uri"
        },
        "old": {
          "type": "string",
          "format": "at-uri"
        }
      },
      "description": "A single channel's old AT-URI mapped to its new AT-URI."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
