Initiate Copy Swap API
Learn how to initiate a Copy Swap for a new CL2C NFT using the `/v1/cl2c/copyswap` endpoint.
The PUT /v1/cl2c/copyswap
endpoint allows you to initiate a Copy Swap for a new CL2C NFT by providing the necessary identifiers for the NFT, the user, and the new owner.
Endpoint
PUT
/v1/cl2c/copyswap
Initiates the Copy Swap process for a new CL2C NFT.
Parameters
Name | Type | Location | Required | Description |
---|---|---|---|---|
tenant | string | Header | Yes | Tenant ID for accessing this API. |
X-API-Key | string | Header | Yes | API Key ID for accessing this API. |
Request Body
Content Type: application/json
Field | Type | Required | Description |
---|---|---|---|
nftId | string | Yes | The unique ID of the NFT being swapped. |
cL2CUserId | string | Yes | The ID of the CL2C user associated with the NFT. |
newOwnerId | string | Yes | The ID of the new owner for the NFT. |
Example Request Body
{
"nftId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"cL2CUserId": "user-1234",
"newOwnerId": "owner-5678"
}
Responses
Success (200)
Content Type: application/json
The response returns the ID of the initiated Copy Swap process.
Example Response
"3fa85f64-5717-4562-b3fc-2c963f66afa6"
Error Responses
The endpoint may return standard error responses for invalid requests or server issues.
Code Samples
Usage in Different Frameworks
Node.js Example
const axios = require('axios');
const data = {
nftId: '3fa85f64-5717-4562-b3fc-2c963f66afa6', // Replace with actual NFT ID
cL2CUserId: 'user-1234', // Replace with actual user ID
newOwnerId: 'owner-5678' // Replace with actual new owner ID
};
axios.put('https://api.example.com/v1/cl2c/copyswap', data, {
headers: {
'tenant': 'your-tenant-id',
'X-API-Key': 'your-api-key'
}
})
.then(response => console.log(response.data))
.catch(error => console.error(error.response.data));