Saltearse al contenido

Registration API

Esta página aún no está disponible en tu idioma.

The Registration API allows you to register provenance claims through Royal’s infrastructure. This guide will help you understand and implement the API effectively.

Overview

The Registration API enables you to:

Prerequisites Before you can use the Registration API, you need to have:

Registrar Setup

  • A Royal registrar account configured in the Royal Console
  • Your application secret key for authentication
  • Webhook endpoints configured (if using webhooks)

User Identity and Delegation

All of this can of course be done manually, but we recommend you offload all of this to Royals IDV flow where this is all taken care of for you.

Getting User Authorization

To obtain user authorization:

  1. Redirect users to the IDV flow: https://royal.io/idv/<your-registrar-username>
  2. After successful IDV, you’ll receive:
    • The user’s Royal ID
    • Confirmation of delegation
    • A signed token for verification
  3. Store the user’s Royal ID for use in registration calls

See the IDV Documentation for detailed implementation guidance.

Quick Start

Terminal window
curl -X POST https://api.royal.io/v0/provenance/register \
-H "Authorization: Bearer ryl_sk_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"originator_id": "123",
"file_url": "https://example.com/content.jpg",
"name": "My Content",
"description": "Description of my content"
}'

Authentication

All API requests require authentication using your application secret key:

Authorization: Bearer ryl_sk_YOUR_SECRET_KEY

You can find your secret key in the Royal Console 🔗 under Services > Indexer Configuration.

API Endpoints

  • POST https://api.royal.io/v0/provenance/register

Request Format

Headers

  • Content-Type: application/json
  • Authorization: Bearer ryl_sk_YOUR_SECRET_KEY

Request Body

FieldTypeRequiredDescription
originator_idstringYesThe Royal ID of the content creator
file_urlstringNo*URL where the content can be accessed
content_hashstringNo*Blake3 hash of the content (hex encoded, no 0x prefix)
namestringYesName of the content
descriptionstringYesDescription of the content (supports Markdown)
external_urlstringNoURL where users can view the content
imagestringNoURL to an image representing the content
multimedia_urlstringNoURL to multimedia attachment or interactive content
metadataobjectNoAdditional metadata for the NFT
provenance_attributesarrayNoAdditional attributes about the claim
contextobjectNoAdditional context passed through to webhooks

* Either file_url or content_hash must be provided

Example Request

{
"originator_id": "123",
"file_url": "https://example.com/content.jpg",
"name": "Digital Artwork #1",
"description": "An original digital artwork created with...",
"external_url": "https://gallery.example.com/artwork/1",
"image": "https://example.com/preview.jpg",
"metadata": {
"artist": "Jane Smith",
"medium": "Digital",
"year": 2024
},
"provenance_attributes": [
{
"type": "ai",
"data": {
"service": {
"account_id": "456",
"name": "Midjourney",
"url": "https://midjourney.com"
},
"metadata": {
"prompt": "A serene landscape..."
}
}
}
]
}

Provenance Attributes

You should include provenance attributes 🔗 in your metadata to describe the content and information related to it’s provenance.

Response Format

Success Response (201 Created)

{
"id": "reg_123abc..."
}

The response includes:

  • HTTP Status: 201 Created
  • Header: x-request-id - Protocol-level identifier
  • Body: Contains API-level identifier

Error Response

{
"error": {
"type": "validation_error",
"message": "file_url or content_hash must be provided"
}
}

Best Practices

  1. Early Registration: Register claims as close to creation time as possible to establish the strongest provenance.
  2. Content Access: When using file_url, ensure the content remains accessible at that URL for Royal to hash it.
  3. Rich Metadata: Include comprehensive metadata and attributes to provide context about the creation process.
  4. Webhook Integration: Implement webhook handlers to track registration status and handle failures gracefully.

Support

Need help? Contact us: