---
updatedAt: 2026-08-27T12:47:20.000Z
agentTools:
  projectIndex: https://b2brouter.readme.io/llms.txt
---

# Issue a Peppol migration code

Issues the migration code that lets the account move its Peppol participant identifier from B2Brouter to another provider. Hand the code to the gaining provider: they use it to claim the identifier.

The account must have a `peppol` transport whose identifier B2Brouter publishes; otherwise there is nothing to migrate and the request is rejected with a `409`.

The call is idempotent: while a code is outstanding, every call returns that same code. To replace it, cancel it with `DELETE` and request a new one. Cancelling and re-issuing invalidates the previous code, so any copy already sent to the gaining provider stops working.

Issuing a code does not move the identifier and does not change reception: documents keep arriving at B2Brouter until the gaining provider completes the migration. Once a code has been issued and not cancelled, the `peppol` transport reports `migration_pending: true`; it stays `true` after the gaining provider completes the migration, and only turns back to `false` when the code is cancelled with `DELETE`.

The code is only returned by this endpoint and never appears in transport responses.


# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "B2Brouter API",
    "description": "The B2Brouter API allows you to send and receive electronic documents.",
    "version": "2026-06-26",
    "contact": {
      "name": "Service Delivery Team",
      "email": "servicedelivery@b2brouter.net"
    }
  },
  "servers": [
    {
      "url": "https://api-staging.b2brouter.net",
      "description": "Test server"
    },
    {
      "url": "https://api.b2brouter.net",
      "description": "Production server"
    }
  ],
  "tags": [
    {
      "name": "Transports",
      "description": "Related to transport configurations"
    }
  ],
  "paths": {
    "/accounts/{account}/transports/peppol/migration_code": {
      "post": {
        "operationId": "create-peppol-migration-code",
        "tags": [
          "Transports"
        ],
        "summary": "Issue a Peppol migration code",
        "description": "Issues the migration code that lets the account move its Peppol participant identifier from B2Brouter to another provider. Hand the code to the gaining provider: they use it to claim the identifier.\n\nThe account must have a `peppol` transport whose identifier B2Brouter publishes; otherwise there is nothing to migrate and the request is rejected with a `409`.\n\nThe call is idempotent: while a code is outstanding, every call returns that same code. To replace it, cancel it with `DELETE` and request a new one. Cancelling and re-issuing invalidates the previous code, so any copy already sent to the gaining provider stops working.\n\nIssuing a code does not move the identifier and does not change reception: documents keep arriving at B2Brouter until the gaining provider completes the migration. Once a code has been issued and not cancelled, the `peppol` transport reports `migration_pending: true`; it stays `true` after the gaining provider completes the migration, and only turns back to `false` when the code is cancelled with `DELETE`.\n\nThe code is only returned by this endpoint and never appears in transport responses.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/account"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "migration_code"
                  ],
                  "properties": {
                    "migration_code": {
                      "type": "string",
                      "example": "Xk9$mQ2!vTz4",
                      "description": "Code to hand to the gaining provider so it can claim the identifier."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "The account has no `peppol` transport (`resource_missing`).\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "No migration code can be issued:\n\n- `conflict` — the Peppol transport of this account is not managed through the API.\n- `migration_unavailable` — migration codes are not available in the sandbox.\n- `not_published_by_b2brouter` — the identifier is not published by B2Brouter, so there is no migration to prepare.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The Peppol SML refused the request (`sml_rejected`). The message carries the refusal.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "The Peppol SML could not be reached: `sml_lookup_failed` while checking the publication state, or `sml_unavailable` while issuing the code. Retry later.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": [
          {
            "api_key": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "api_key": {
        "type": "apiKey",
        "description": "API Key of your account",
        "name": "X-B2B-API-Key",
        "in": "header"
      }
    },
    "parameters": {
      "account": {
        "name": "account",
        "in": "path",
        "description": "Account identifier (ID)",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "my-account"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "description": "Represents an error object returned in a failed request",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "A unique error code identifying the type of error. See https://developer.b2brouter.net/docs/error_codes for the full code list.",
                "example": "parameter_empty"
              },
              "message": {
                "type": "string",
                "description": "A human-readable error message providing more context about the error.",
                "example": "The parameter 'param' is missing or the value is empty"
              },
              "param": {
                "type": "string",
                "description": "The parameter in the request that caused the error (if applicable).",
                "example": "param"
              },
              "type": {
                "type": "string",
                "description": "The type of error. Currently the only possible value is \"invalid_request_error\".",
                "example": "invalid_request"
              }
            }
          }
        }
      },
      "UnauthorizedError": {
        "type": "object",
        "description": "Represents an error object returned in a failed request",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "A unique error code identifying the type of error.",
                "example": "unauthorized",
                "default": "unauthorized"
              },
              "message": {
                "type": "string",
                "description": "A human-readable error message providing more context about the error.",
                "example": "Invalid API Key provided, or the API key might not have the necessary permissions for this action."
              },
              "type": {
                "type": "string",
                "description": "The type of error, often mirrors the error code for clarity.",
                "example": "invalid_request_error",
                "default": "invalid_request_error"
              }
            }
          }
        }
      },
      "ForbiddenError": {
        "type": "object",
        "description": "Represents an error object returned when the target project is archived",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "A unique error code identifying the type of error.",
                "example": "403",
                "default": "403"
              },
              "message": {
                "type": "string",
                "description": "A human-readable error message providing more context about the error.",
                "example": "The project you are trying to access has been archived."
              },
              "type": {
                "type": "string",
                "description": "The type of error, often mirrors the error code for clarity.",
                "example": "invalid_request_error",
                "default": "invalid_request_error"
              }
            }
          }
        }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/UnauthorizedError"
            }
          }
        }
      },
      "Forbidden": {
        "description": "Forbidden",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ForbiddenError"
            }
          }
        }
      }
    }
  }
}
```