Migrate account
Accounts within On3 are based on wallet addresses. You can use this API endpoint to migrate one account to another, e.g., if a user has lost access to their old wallet and wants to migrate their balances, XP, settings, etc.
Calling this endpoint will COPY and DELETE all data from account fromAddress to account toAddress.
Any open raffles or auctions the user has entered or bid on will not be transfered.
This command does not migrate users' historic data, i.e., previous quest completions, their notifications, or purchased shop items.
Request
HTTP POST to /accounts/migrate with Content-Type: application/json and a JSON body of:
- Example
- Schema
{
"fromAddress": "0x435Cd3902d1b4f4E842F2C0fd5028EEE71dd099C",
"toAddress": "0xd03ea8624C8C5987235048901fB614fDcA89b117",
"withEmail": "george@on3.one",
"forceMerge": "true"
}
{
"fromAddress": "string",
"toAddress": "string",
"withEmail": "string",
"forceMerge": boolean
}
Fields
fromAddress
The wallet addresses of the account you want to migrate from. This wallet must already have an On3 account.
After using this endpoint, the account attached to fromAddress will become "zero'd", having all of its data deleted.
| Type | string |
| Required | Yes |
| Limitations | Must be a valid checksum address |
| Examples | "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" |
toAddress
The wallet address you want to create a new account for and migrate to. If the account already exists, the API will return an error unless forceMerge is set.
| Type | string |
| Required | Yes |
| Limitations | Must be a valid checksum address |
| Examples | "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" |
withEmail
If this parameter is set, the migration will only happen if the withEmail value matches (case insensitive) the email for the fromAddress account.
| Type | string |
| Required | No |
| Limitations | Must be a valid email address |
| Examples | "bill@gmail.com" |
forceMerge
If set to true and an account for toAddress already exists then we will merge both accounts balances and XP instead of overwriting.
| Type | boolean |
| Required | No |
| Limitations | |
| Examples | true |
Response
You should appropriately handle any errors when wasSuccessful is false. The errors array will detail what went wrong, i.e., an account for toAddress already exists.
- Success (2XX)
- Failure (4XX)
{
"newAccount": {
// .. full updated account object for `toAddress` (see https://docs.on3.one/api/routes/accounts/get#response)
},
"wasSuccessful": boolean, // true or false
"errors": [ // array of errors
"string"
]
}
{
"wasSuccessful": boolean,
"errors": [
"string"
]
}
Codes
| Code | Success | Description |
|---|---|---|
| 2XX | Yes | Your request was accepted and the account was either updated or created. |
| 4XX | No | Check the response body for details on what needs changing in the request. If the error continues and the request appears to be valid, please report this to the On3 support team. |
| 5XX | No | Your request failed due to a server-side error. If the error continues after several attempts, please report this to the On3 support team. |