Skip to main content
POST
/
v1
/
chains
/
{chain_name}
/
collections
/
{contract_address}
/
nfts
/
refresh-metadata
Refresh NFT metadata
curl --request POST \
  --url https://api.sandbox.immutable.com/v1/chains/{chain_name}/collections/{contract_address}/nfts/refresh-metadata \
  --header 'Content-Type: application/json' \
  --header 'x-immutable-api-key: <api-key>' \
  --data '
{
  "nft_metadata": [
    {
      "name": "Sword",
      "description": "2022-08-16T17:43:26.991388Z",
      "image": "https://some-url",
      "external_url": "https://some-url",
      "animation_url": "https://some-url",
      "youtube_url": "https://some-url",
      "attributes": [
        {
          "trait_type": "Aqua Power",
          "value": "Happy",
          "display_type": "number"
        }
      ],
      "token_id": "1"
    }
  ]
}
'
import requests

url = "https://api.sandbox.immutable.com/v1/chains/{chain_name}/collections/{contract_address}/nfts/refresh-metadata"

payload = { "nft_metadata": [
{
"name": "Sword",
"description": "2022-08-16T17:43:26.991388Z",
"image": "https://some-url",
"external_url": "https://some-url",
"animation_url": "https://some-url",
"youtube_url": "https://some-url",
"attributes": [
{
"trait_type": "Aqua Power",
"value": "Happy",
"display_type": "number"
}
],
"token_id": "1"
}
] }
headers = {
"x-immutable-api-key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'x-immutable-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
nft_metadata: [
{
name: 'Sword',
description: '2022-08-16T17:43:26.991388Z',
image: 'https://some-url',
external_url: 'https://some-url',
animation_url: 'https://some-url',
youtube_url: 'https://some-url',
attributes: [{trait_type: 'Aqua Power', value: 'Happy', display_type: 'number'}],
token_id: '1'
}
]
})
};

fetch('https://api.sandbox.immutable.com/v1/chains/{chain_name}/collections/{contract_address}/nfts/refresh-metadata', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.immutable.com/v1/chains/{chain_name}/collections/{contract_address}/nfts/refresh-metadata",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'nft_metadata' => [
[
'name' => 'Sword',
'description' => '2022-08-16T17:43:26.991388Z',
'image' => 'https://some-url',
'external_url' => 'https://some-url',
'animation_url' => 'https://some-url',
'youtube_url' => 'https://some-url',
'attributes' => [
[
'trait_type' => 'Aqua Power',
'value' => 'Happy',
'display_type' => 'number'
]
],
'token_id' => '1'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-immutable-api-key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.sandbox.immutable.com/v1/chains/{chain_name}/collections/{contract_address}/nfts/refresh-metadata"

payload := strings.NewReader("{\n \"nft_metadata\": [\n {\n \"name\": \"Sword\",\n \"description\": \"2022-08-16T17:43:26.991388Z\",\n \"image\": \"https://some-url\",\n \"external_url\": \"https://some-url\",\n \"animation_url\": \"https://some-url\",\n \"youtube_url\": \"https://some-url\",\n \"attributes\": [\n {\n \"trait_type\": \"Aqua Power\",\n \"value\": \"Happy\",\n \"display_type\": \"number\"\n }\n ],\n \"token_id\": \"1\"\n }\n ]\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-immutable-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.sandbox.immutable.com/v1/chains/{chain_name}/collections/{contract_address}/nfts/refresh-metadata")
.header("x-immutable-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"nft_metadata\": [\n {\n \"name\": \"Sword\",\n \"description\": \"2022-08-16T17:43:26.991388Z\",\n \"image\": \"https://some-url\",\n \"external_url\": \"https://some-url\",\n \"animation_url\": \"https://some-url\",\n \"youtube_url\": \"https://some-url\",\n \"attributes\": [\n {\n \"trait_type\": \"Aqua Power\",\n \"value\": \"Happy\",\n \"display_type\": \"number\"\n }\n ],\n \"token_id\": \"1\"\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.sandbox.immutable.com/v1/chains/{chain_name}/collections/{contract_address}/nfts/refresh-metadata")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-immutable-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"nft_metadata\": [\n {\n \"name\": \"Sword\",\n \"description\": \"2022-08-16T17:43:26.991388Z\",\n \"image\": \"https://some-url\",\n \"external_url\": \"https://some-url\",\n \"animation_url\": \"https://some-url\",\n \"youtube_url\": \"https://some-url\",\n \"attributes\": [\n {\n \"trait_type\": \"Aqua Power\",\n \"value\": \"Happy\",\n \"display_type\": \"number\"\n }\n ],\n \"token_id\": \"1\"\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "imx_refreshes_limit": "<string>",
  "imx_refresh_limit_reset": "<string>",
  "imx_remaining_refreshes": "<string>",
  "retry_after": "<string>"
}
{
"message": "all fields must be provided",
"link": "https://docs.x.immutable.com/reference/#/",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "VALIDATION_ERROR",
"details": {}
}
{
"message": "all fields must be provided",
"link": "https://docs.x.immutable.com/reference/#/",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "UNAUTHORISED_REQUEST",
"details": {}
}
{
"message": "all fields must be provided",
"link": "https://docs.x.immutable.com/reference/#/",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "AUTHENTICATION_ERROR",
"details": {}
}
{
"message": "all fields must be provided",
"link": "https://docs.x.immutable.com/reference/#/",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "RESOURCE_NOT_FOUND",
"details": {}
}
{
"message": "all fields must be provided",
"link": "https://docs.x.immutable.com/reference/#/",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "TOO_MANY_REQUESTS_ERROR",
"details": {}
}
{
"message": "all fields must be provided",
"link": "https://docs.x.immutable.com/reference/#/",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "INTERNAL_SERVER_ERROR",
"details": {}
}

Authorizations

x-immutable-api-key
string
header
required

Path Parameters

contract_address
string
required

The address of contract

chain_name
string
required

The name of chain

Example:

"imtbl-zkevm-testnet"

Body

application/json

the request body

nft_metadata
object[]
required

List of nft metadata to be refreshed. Total size of the list should not exceed 228 KiB

Required array length: 1 - 250 elements

Response

Accepted

imx_refreshes_limit
string
required
imx_refresh_limit_reset
string
required
imx_remaining_refreshes
string
required
retry_after
string
required