Skip to content

1. Web 3.0 API

Tammy Yang edited this page Oct 23, 2022 · 10 revisions

Create Web 3.0 Assets

Registration

DESCRIPTION

Web 3.0 asset registration API provides every file with the following services:

  • A Web 3.0 unique address
  • Pinned storage on IPFS network
  • A NFT token associated with this asset
  • Creation and ownership records on chain
  • Content authenticity injection (png/jpeg files only)

EXAMPLE

curl -s -X POST 'https://api.numbersprotocol.io/api/v3/assets/' \
    -H "Authorization: token ${YOUT_API_TOKEN}" \
    -F 'supporting_file=https://ipfs.io/ipfs/QmSC69ZWFaM23MixbS4HjLcvuEKiQwGLZzrUvFQyXnFnxc' \
    -F 'asset_file=@/home/example/assets/asset-cover_2.jpg' \
    -F 'signature=[{
        "proofHash": "78b67e15077577a9b25393f13bfccde3f94f990cf2a7bb0584a51f09196abbbf",
            "provider": "AndroidOpenSSL",
                "signature": "3046022100b96babf7fb1a374792ce47cebdf0b5a40166352a4e8aed2d8e84a04699898c72022100ec0646e318a0701f794fd0a3dc28da41ff864a1f9156e694b890a1800edd86b0",
                    "publicKey": "3059301306072a8648ce3d020106082a8648ce3d030107034200043e4ba565aa9158b9aeafc1bb4a970bfc7fcdcc398c35bb525aedd37bbf459dbd30868b909ec6b78f7904474c225e02f45c2384b0f4ece0d68e2c3c84fce04686"
}]' \
    -F 'meta={
        "proof":{
            "hash": "78b67e15077577a9b25393f13bfccde3f94f990cf2a7bb0584a51f09196abbbf",
            "timestamp": 1619145000000,
            "mimeType": "image/jpeg"
        },  
        "information":[
            {
                "provider": "InfoSnapshot",
                "name": "Current GPS Address",
                "value": "No. 299, Section 4, Bade Road, Songshan District Taipei City"
            },
            {
                "provider": "InfoSnapshot",
                "name": "Timestamp",
                "value": "2021-04-23T02:30:00.279Z"
            },
            {
                "provider": "InfoSnapshot",
                "name": "Current GPS Latitude",
                "value": 25.049190
            },
            {
                "provider": "InfoSnapshot",
                "name": "Current GPS Longitude",
                "value": 121.566440
            },
            {
                "provider": "InfoSnapshot",
                "name": "Device Name",
                "value": "Firefox"
            },
            {
                "provider": "InfoSnapshot",
                "name": "Manufacturer",
                "value": "Asus"
            }
        ]
    }' \
    -F 'target_provider=Signature' \
    -F 'caption=This an example.'

SAMPLE RESULT

{
    "id": "bafybeie23hdjuurtc5n77vbhjx6mmrmjo3lyzmtks4eki5ibwpqjoeb3eq",
    "asset_file_url": "http://ipfs-pin.numbersprotocol.io/ipfs/bafybeie23hdjuurtc5n77vbhjx6mmrmjo3lyzmtks4eki5ibwpqjoeb3eq",
    "asset_file_name": "asset-cover_2.jpg",
    "asset_file_mime_type": "image/jpeg",
    "supporting_file": "https://ipfs.io/ipfs/QmSC69ZWFaM23MixbS4HjLcvuEKiQwGLZzrUvFQyXnFnxc",
    "nft_spec": "ERC721",
    "nft_token_id": "18672",
    "nft_blockchain_name": "ethereum",
    "nft_contract_address": "0xb7ccc262d322d1dc1c64cbb56a6827589b4bc874",
    "caption": "string",
    "tag": "["art", "photography"]",
}

AUTHORIZATION

  • token: Please acquire your token from Numbers Protocol

HEADERS

  • Content-Type: multipart/form-data

BODY (formdata)

More parameters please see API document

Query Web 3.0 Asset ID

DESCRIPTION

This API returns the Web 3.0 asset ID of a file. It is also the IPFS address of the file if the file was registered to the network before.

EXAMPLE

curl --location --request POST 'https://node.numbersprotocol.io/api/1.1/wf/query_asset_from_file' 
--header 'Authorization: Bearer ${YOUR_API_KEY}' \
--form 'file="{FILE_URL}"'

SAMPLE RESULT

{
    "status": "success",
    "response": {
        "asset": "bafkreic246ml4ec7wbwou5saezxwiqzpgikrwhigo5r4bjr25qdsqqq7ni"
    }
}

AUTHORIZATION

  • API Key: Please acquire your API key from Numbers Protocol

HEADERS

  • Content-Type: multipart/form-data

BODY (formdata)

Parameter Type Sample Data Default Value Description
file Required //s3.amazonaws.com/test.jpeg N/A URL of File

Full list of Asset APIs

See here for the full API list.

NFT Related APIs

Get NFT Asset Addresses

DESCRIPTION

This API returns the Web 3.0 address and its IPFS pin URL of NFT asset files (i.e. the image or video files bonded to the NFT).

EXAMPLE

curl --location --request POST 'https://node.numbersprotocol.io/api/1.1/wf/get_nft_asset' \
--header 'Authorization: Bearer ${YOUR_API_KEY}' \
--form 'contract_address="{NFT_CONTRACT_ADDEESS}"' \
--form 'token_id="${NFT_TOKEN_ID}"'

SAMPLE RESULT

{
    "status": "success",
    "response": {
        "asset_id": "bafkreigndqma6324o7yi26vqfxllnh3myznhdclvhr252ndnct2wutmkjy",
        "ipfs_url": "https://ipfs-pin.numbersprotocol.io/ipfs/bafkreigndqma6324o7yi26vqfxllnh3myznhdclvhr252ndnct2wutmkjy"
    }
}

AUTHORIZATION

  • API Key: Please acquire your API key from Numbers Protocol

HEADERS

  • Content-Type: multipart/form-data

BODY (formdata)

Parameter Type Sample Data Default Value Description
contract_address Required 0x05a46f1e545526fb803ff974c790acea34d1f2d6 N/A The address of the NFT token.
token_id Required 5336 N/A The token_id of the NFT token.

Get NFT Tokens from Assets

DESCRIPTION

This API returns the associated NFT tokens, the current owners, their marketplaces, product_urls of the input asset ID. It also returns the associated assets such as thumbnails or animations.

EXAMPLE

curl --location --request POST 'https://node.numbersprotocol.io/api/1.1/wf/get_nft_asset' \
--header 'Authorization: Bearer ${YOUR_API_KEY}' \
--form 'asset_id="{ASSET_ID}"'

SAMPLE RESULT

{
    "status": "success",
    "response": {
        "asset": "bafkreigndqma6324o7yi26vqfxllnh3myznhdclvhr252ndnct2wutmkjy",
        "result": [
            {
                "_api_c2__id": "614701226085082b00608071",
                "_api_c2_nft_products": [
                    {
                        "_api_c2__id": "6153f38874ef1a1b41f61f3b",
                        "_api_c2_marketplace._id": "611230c4973b97aa2c5d7523",
                        "_api_c2_marketplace.name": "opensea",
                        "_api_c2_marketplace.logo": "https://i.imgur.com/1Y09MZC.png",
                        "_api_c2_marketplace.site_url": "https://opensea.io/",
                        "_api_c2_product_url": "https://opensea.io/assets/0x05a46f1e545526fb803ff974c790acea34d1f2d6/5336"
                    }
                ],
                "_api_c2_image_cid": "bafkreigndqma6324o7yi26vqfxllnh3myznhdclvhr252ndnct2wutmkjy",
                "_api_c2_animation_cid": null,
                "_api_c2_asset_cids": [
                    "bafkreigndqma6324o7yi26vqfxllnh3myznhdclvhr252ndnct2wutmkjy",
                    "bafkreigndqma6324o7yi26vqfxllnh3myznhdclvhr252ndnct2wutmkjy",
                    "QmUTTGDuQPeBsFCs7EV3UWdGaKUeDzZoQzJyBkXG8s4ZDS",
                    "bafkreigndqma6324o7yi26vqfxllnh3myznhdclvhr252ndnct2wutmkjy"
                ],
                "_api_c2_image_url": "https://storage.opensea.io/files/f9d1b70505cda9fb0c15f31e9622a815.svg",
                "_api_c2_created_at": "2021-09-03T15:29:35.450000",
                "_api_c2_chain_id": 1,
                "_api_c2_contract": "0x05a46f1e545526fb803ff974c790acea34d1f2d6",
                "_api_c2_nft_spec": null,
                "_api_c2_token_id": "5336",
                "_api_c2_token_uri": "data:application/json;base64,eyJuYW1lIjogIk4gIzUzMzYiLCAiZGVzY3JpcHRpb24iOiAiTiBpcyBqdXN0IG51bWJlcnMuIiwgImltYWdlIjogImRhdGE6aW1hZ2Uvc3ZnK3htbDtiYXNlNjQsUEhOMlp5QjRiV3h1Y3owaWFIUjBjRG92TDNkM2R5NTNNeTV2Y21jdk1qQXdNQzl6ZG1jaUlIQnlaWE5sY25abFFYTndaV04wVW1GMGFXODlJbmhOYVc1WlRXbHVJRzFsWlhRaUlIWnBaWGRDYjNnOUlqQWdNQ0F6TlRBZ016VXdJajQ4YzNSNWJHVStMbUpoYzJVZ2V5Qm1hV3hzT2lCM2FHbDBaVHNnWm05dWRDMW1ZVzFwYkhrNklITmxjbWxtT3lCbWIyNTBMWE5wZW1VNklERTBjSGc3SUgwOEwzTjBlV3hsUGp4eVpXTjBJSGRwWkhSb1BTSXhNREFsSWlCb1pXbG5hSFE5SWpFd01DVWlJR1pwYkd3OUltSnNZV05ySWlBdlBqeDBaWGgwSUhnOUlqRXdJaUI1UFNJeU1DSWdZMnhoYzNNOUltSmhjMlVpUGpJOEwzUmxlSFErUEhSbGVIUWdlRDBpTVRBaUlIazlJalF3SWlCamJHRnpjejBpWW1GelpTSStPRHd2ZEdWNGRENDhkR1Y0ZENCNFBTSXhNQ0lnZVQwaU5qQWlJR05zWVhOelBTSmlZWE5sSWo0eVBDOTBaWGgwUGp4MFpYaDBJSGc5SWpFd0lpQjVQU0k0TUNJZ1kyeGhjM005SW1KaGMyVWlQalU4TDNSbGVIUStQSFJsZUhRZ2VEMGlNVEFpSUhrOUlqRXdNQ0lnWTJ4aGMzTTlJbUpoYzJVaVBqRXhQQzkwWlhoMFBqeDBaWGgwSUhnOUlqRXdJaUI1UFNJeE1qQWlJR05zWVhOelBTSmlZWE5sSWo0eFBDOTBaWGgwUGp4MFpYaDBJSGc5SWpFd0lpQjVQU0l4TkRBaUlHTnNZWE56UFNKaVlYTmxJajQ1UEM5MFpYaDBQangwWlhoMElIZzlJakV3SWlCNVBTSXhOakFpSUdOc1lYTnpQU0ppWVhObElqNDJQQzkwWlhoMFBqd3ZjM1puUGc9PSJ9",
                "_api_c2_creator": "0x25ce5b3b5eae246c8abcfdb71593678f424fce47",
                "_api_c2_current_owner": "0xbe3026082402c7bb344729ce3a51b259bf1e5915",
                "_api_c2_metadata_cid": null,
                "_api_c2_metadata.name": "N #5336",
                "_api_c2_metadata.description": "N is just numbers.",
                "_api_c2_metadata.image": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaW5ZTWluIG1lZXQiIHZpZXdCb3g9IjAgMCAzNTAgMzUwIj48c3R5bGU+LmJhc2UgeyBmaWxsOiB3aGl0ZTsgZm9udC1mYW1pbHk6IHNlcmlmOyBmb250LXNpemU6IDE0cHg7IH08L3N0eWxlPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9ImJsYWNrIiAvPjx0ZXh0IHg9IjEwIiB5PSIyMCIgY2xhc3M9ImJhc2UiPjI8L3RleHQ+PHRleHQgeD0iMTAiIHk9IjQwIiBjbGFzcz0iYmFzZSI+ODwvdGV4dD48dGV4dCB4PSIxMCIgeT0iNjAiIGNsYXNzPSJiYXNlIj4yPC90ZXh0Pjx0ZXh0IHg9IjEwIiB5PSI4MCIgY2xhc3M9ImJhc2UiPjU8L3RleHQ+PHRleHQgeD0iMTAiIHk9IjEwMCIgY2xhc3M9ImJhc2UiPjExPC90ZXh0Pjx0ZXh0IHg9IjEwIiB5PSIxMjAiIGNsYXNzPSJiYXNlIj4xPC90ZXh0Pjx0ZXh0IHg9IjEwIiB5PSIxNDAiIGNsYXNzPSJiYXNlIj45PC90ZXh0Pjx0ZXh0IHg9IjEwIiB5PSIxNjAiIGNsYXNzPSJiYXNlIj42PC90ZXh0Pjwvc3ZnPg==",
                "_api_c2_primary_marketplace": "opensea",
                "_api_c2_nftscan_id": "NS000003DE979A8559"
            }
        ]
    }
}

AUTHORIZATION

  • API Key: Please acquire your API key from Numbers Protocol

HEADERS

  • Content-Type: multipart/form-data

BODY (formdata)

Parameter Type Sample Data Default Value Description
asset_id Required bafkreigndqma6324o7yi26vqfxllnh3myznhdclvhr252ndnct2wutmkjy N/A The Web 3.0 address of the asset file.

Search Engine APIs

Similar Image API

DESCRIPTION

This API returns the top similar image results in search engine.

EXAMPLE

curl --location --request POST 'https://node.numbersprotocol.io/api/1.1/wf/find_similar' \
     --form 'file="https://ipfs-pin.numbersprotocol.io/ipfs/bafybeia7buylzu37ldtugql2eupy64fw3gzjqyoivgt3jyxe6d4yuggh24"' \
     --form 'only_closest_match="false"' \
     -H 'Accept: application/json' \
     -H 'Authorization: Bearer ${API_TOKEN}'

SAMPLE RESULT

{
    "status": "success",
    "response": {
        "closest_match": "bafkreid55kfgodc3mfd2x5euj2d3raxre3cl35fvygiodfjpw4snglidvu",
        "top_results": [
            "bafkreid55kfgodc3mfd2x5euj2d3raxre3cl35fvygiodfjpw4snglidvu",
            "bafkreiavqdcck6gcwe6aa22levdmmydteorp2goti4lvflcwre2i2ezatm",
            "bafkreicjxtv5ovzkd6vmzw42eahxg23mheyo4bq7iz7oducso2g735ndh4"
        ]
    }
}

AUTHORIZATION

  • API Key: Please acquire your API key from Numbers Protocol

HEADERS

  • Content-Type: multipart/form-data

BODY (formdata)

Parameter Type Sample Data Default Value Description
file Required https://ipfs-pin.numbersprotocol.io/ipfs/bafkreid55kfgodc3mfd2x5euj2d3raxre3cl35fvygiodfjpw4snglidvu N/A Image url for search image
only_closest_match Required false N/A If true, only closest match result would be returned

Access Token Records

DESCRIPTION

This API returns the token records associated to the input asset.

EXAMPLE

curl --location --request POST 'https://node.numbersprotocol.io/api/1.1/wf/asset-search' \
     --form 'file="https://ipfs-pin.numbersprotocol.io/ipfs/bafybeiepger65zllufxocswogj2h3bmnb2vbcekuzhbavbex2edvdzjwja"' \
     --form 'only_closest_match="false"' \
     -H 'Accept: application/json' \
     -H 'Authorization: Bearer ${API_TOKEN}'

SAMPLE RESULT

{
    "status": "success",
    "response": {
        "nft_record": [
            {
                "_api_c2__id": "620106dbf9d84630238c1012",
                "_api_c2_nft_products": [],
                "_api_c2_image_cid": "bafybeiepger65zllufxocswogj2h3bmnb2vbcekuzhbavbex2edvdzjwja",
                "_api_c2_animation_cid": null,
                "_api_c2_asset_cids": [],
                "_api_c2_image_url": "https://ikzttp.mypinata.cloud/ipfs/QmYDvPAXtiJg7s8JdRBSLWdgSphQdac8j1YuQNNxcGE1hg/982.png",
                "_api_c2_created_at": "2022-01-13T02:00:38",
                "_api_c2_chain_id": 1,
                "_api_c2_contract": "0xed5af388653567af2f388e6224dc7c4b3241c544",
                "_api_c2_nft_spec": "ERC721",
                "_api_c2_token_id": "982",
                "_api_c2_token_uri": "https://dweb.link/ipfs/QmQFkLSQysj94s5GvTHPyzTxrawwtjgiiYS2TBLgrvw8CW/982",
                "_api_c2_creator": "0xab06f95ad1ac282f7072b4b849259eabc49eb5ba",
                "_api_c2_current_owner": "0x5a8cfbdb26e7429e4920668412347e0da368c5ec",
                "_api_c2_metadata_cid": null,
                "_api_c2_metadata.name": "Azuki #982",
                "_api_c2_metadata.description": null,
                "_api_c2_metadata.image": "https://ikzttp.mypinata.cloud/ipfs/QmYDvPAXtiJg7s8JdRBSLWdgSphQdac8j1YuQNNxcGE1hg/982.png",
                "_api_c2_primary_marketplace": "opensea",
                "_api_c2_nftscan_id": "NS4D1BB1435DE9AA9E",
                "body_raw_text": null
            },
            {
                "_api_c2__id": "631a76e11ba1656d93d54686",
                "_api_c2_nft_products": [],
                "_api_c2_image_cid": "bafybeiepger65zllufxocswogj2h3bmnb2vbcekuzhbavbex2edvdzjwja",
                "_api_c2_animation_cid": null,
                "_api_c2_asset_cids": [],
                "_api_c2_image_url": "https://ikzttp.mypinata.cloud/ipfs/QmYDvPAXtiJg7s8JdRBSLWdgSphQdac8j1YuQNNxcGE1hg/982.png",
                "_api_c2_created_at": "2022-01-24T14:45:06",
                "_api_c2_chain_id": 137,
                "_api_c2_contract": "0x57aedae1123e4f896f5b143fd0a18d29424e1a80",
                "_api_c2_nft_spec": "erc721",
                "_api_c2_token_id": "982",
                "_api_c2_token_uri": "https://dweb.link/ipfs/QmeBWSnYPEnUimvpPfNHuvgcK9wFH9Sa6cZ4KDfgkfJJis/982",
                "_api_c2_creator": "0xeed52a4d35cf0cb9b9340b6d15522e75f1f8aa9e",
                "_api_c2_current_owner": "0xeed52a4d35cf0cb9b9340b6d15522e75f1f8aa9e",
                "_api_c2_metadata_cid": null,
                "_api_c2_metadata.name": "Azuki #982",
                "_api_c2_metadata.description": null,
                "_api_c2_metadata.image": "https://ikzttp.mypinata.cloud/ipfs/QmYDvPAXtiJg7s8JdRBSLWdgSphQdac8j1YuQNNxcGE1hg/982.png",
                "_api_c2_primary_marketplace": null,
                "_api_c2_nftscan_id": "NSFB439169F3BA3AB2",
                "body_raw_text": null
            }
        ]
    }
}

AUTHORIZATION

  • API Key: Please acquire your API key from Numbers Protocol

HEADERS

  • Content-Type: multipart/form-data

BODY (formdata)

Parameter Type Sample Data Default Value Description
file Required https://ipfs-pin.numbersprotocol.io/ipfs/bafkreid55kfgodc3mfd2x5euj2d3raxre3cl35fvygiodfjpw4snglidvu N/A Image url for search image
only_closest_match Required true N/A This should always be true

Network Actions

Query Numbers Network Action Orders

DESCRIPTION

Numbers network action orders are stored in a table in the Bubble numbers-upvote project, which can be queried with Bubble data API.

EXAMPLE

curl -X GET https://numbers-upvote.bubbleapps.io/api/1.1/obj/order

SAMPLE RESULT

{
    "response": {
        "cursor": 0,
        "results": [
            {
                "asset_id_text": "bafkreifok5dbj3oitzxk35n3epenpyqtrnotnoapbp7cxtypquw46ryxxe",
                "gas_fee_number": 0,
                "network_app_id_text": "e9f1f451-73b2-4d68-9bbb-916e18ad58ee",
                "network_app_name_text": "Gift a Capture",
                "order_id_text": "a803b0d8-0797-4a98-8924-be8a136bbbf1",
                "price_number": 1,
                "status_text": "submitted",
                "total_cost_number": 1,
                "uid_text": "0x36122242e625B21B2A28242767269971Ee19091E",
                "Created Date": "2022-03-23T03:46:51.711Z",
                "Created By": "non_authenticated_user_numbers-upvote_live",
                "Modified Date": "2022-03-23T03:46:51.717Z",
                "_id": "1648007211711x842868014507268600"
            },
            ....
        ],
        "remaining": 0,
        "count": 69
    }
}    

For more details about querying with constraint, sorting, and pagination, see Bubble Data API doc.

AUTHORIZATION

  • API Key: None

HEADERS

None

Order Hisotry Record Schema

Only non-empty fields will be returned.

Field Type Sample Data Description
action_id text "1647829952663x703010389640311400" Network action id
asset_id text "bafybeiec2hb3snb3xp23bk4zt62d4xyyyyselzdtqia2wv7vwqiumpudqi" Asset id
blockchain_name text "IOTA"
cost_token_ticker text "NUM" The ticker of cost token
ext_action_cost number 0 Cost from external partner
fee_tx_hash text "0x13f2b095208ac6f8ea2a6614b3ad326adc3eea05c766964ddfd3ff6e1c593f97" The transaction hash of gas fee
fund_tx_hash text "0x13f2b095208ac6f8ea2a6614b3ad326adc3eea05c766964ddfd3ff6e1c593f97" The transaction hash of fund
gas_fee number 1.5731715947595004 Gas fee for the order
network_action_cost number 1 The cost of the network action
network_app_id text "8749e233-6960-4247-bf13-f7af76f1bcb6"
network_app_name text "Web 3.0 Archive"
order_id text "113cdc2f-d23a-4355-9f1c-581092636c76" Unique Order id in Numbers Backend
payment_tx_hash text "0x13f2b095208ac6f8ea2a6614b3ad326adc3eea05c766964ddfd3ff6e1c593f97" The transaction hash of price payment
price number 1 The price of the order
result_tx text "f6f4f37e-7097-4d71-8b71-7ed686ff518a" Result id of the order
result_url text Result url of the order
status text "completed" Network action order status
total_cost number 0 Total cost of the network action
uid text "0x36122242e625B21B2A28242767269971Ee19091E" User integrity wallet address
Created Date text "2022-03-23T03:46:51.711Z"
Modified Date text "2022-03-23T03:46:51.711Z"
_id text "1648007211711x842868014507268600" Unique Bubble order history entry id

Nit, Native Protocol Tool

Please see here