# Move events to a different type

## `POST /v1/events/move`

Use dryRun to preview the change. Applying a move requires a user with admin scope. Requires the `schema:write` scope.

```json
{
  "tags": [
    "Events"
  ],
  "operationId": "move-events",
  "summary": "Move events to a different type",
  "description": "Use dryRun to preview the change. Applying a move requires a user with admin scope. Requires the `schema:write` scope.",
  "x-retainer-scope": "schema:write",
  "parameters": [],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "from": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100,
              "description": "The event type the events have now (API name), e.g. \"meeting\"."
            },
            "to": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100,
              "description": "The event type they move to (API name), e.g. \"conversation\"."
            },
            "events": {
              "description": "Only these events, all of type from (at most 1000). Without it, every live event of from moves.",
              "minItems": 1,
              "maxItems": 1000,
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              }
            },
            "fields": {
              "default": {},
              "description": "Source field name to target field name, for fields named differently, e.g. { \"agenda\": \"topic\" }. Other fields map by name; title and summary always map to the target's own.",
              "type": "object",
              "propertyNames": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "additionalProperties": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              }
            },
            "drop": {
              "default": [],
              "description": "Source fields whose values you agree to delete because the target has no field for them. Without it, a move that would lose values is refused with the list.",
              "maxItems": 200,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              }
            },
            "defaults": {
              "default": {},
              "description": "Target field values for moved events that have no value for that field, written as if logged with the event, e.g. { \"medium\": \"meeting\" } when moving meetings to conversation.",
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            },
            "dryRun": {
              "default": false,
              "description": "Check the move and report what it would do, changing nothing.",
              "type": "boolean"
            }
          },
          "required": [
            "from",
            "to"
          ],
          "additionalProperties": false
        },
        "example": {
          "from": "meeting",
          "to": "conversation",
          "defaults": {
            "medium": "meeting"
          },
          "dryRun": true
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Successful response.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/MoveEventsResult"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "default": {
      "$ref": "#/components/responses/ApiError"
    }
  }
}
```

[Full OpenAPI contract](/openapi.json)
