Download C2PA Asset

The prerequisite of the API includes acquiring the Capture Token following the instructions and registration of the asset following the initial asset registration instructions.

In order to verify the C2PA content, you may visit the official Verify page provided by C2PA. For more details about C2PA, see the C2PA official website.

API Endpoint: https://api.numbersprotocol.io/api/v3/assets/NID/c2pa/

Cost: 0 NUM (free to use)

Method: POST

Authentication:
This API requires a valid token for Authorization.
The token should be passed in the headers of the 
request using the following format:
"Authorization: token YOUR_CAPTURE_TOKEN"

Path parameter (required):
nid (string): Nid of the asset to download

Examples:
curl -X POST https://api.numbersprotocol.io/api/v3/assets/NID/c2pa/ \
    -H "Content-Type: application/json" \
    -H "Authorization: token YOUR_CAPTURE_TOKEN"

Response:
{
    "url": string, // URL for downloading the C2PA asset.
    "cid": string // cid of the C2PA asset. Note that because of the nature of C2PA injection, the cid will not be the same as the asset nid.
}

import requests
import json

# Define the API endpoint
url = "https://api.numbersprotocol.io/api/v3/assets/{nid}/c2pa/"

# Define the headers for the request
headers = {
    "Content-Type": "application/json",
    "Authorization": "token YOUR_CAPTURE_TOKEN" # Replace YOUR_CAPTURE_TOKEN with your own
}

# Define the path parameters for the request
url = url.format(nid=NID) # Replace NID with the Nid of the asset you want to create and download C2PA file

# Send the POST request to the API endpoint
response = requests.post(url, headers=headers)

# Check the response status code
if response.status_code != 200:
    print(f"Error: {response.status_code} - {response.text}")
else:
    # Parse the JSON response
    json_data = response.json()
    download_url = json_data["url"]
    print(download_url)

Last updated