> ## Documentation Index
> Fetch the complete documentation index at: https://docs.therootnetwork.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Register Asset with Schema

> Link a collection or specific token to a schema so the Asset Registry can validate and generate the Asset Tree.

This guide covers linking:

1. On-chain collections / tokens
2. Off-chain collections / assets (after initial off-chain asset registration)

## Register a Collection

Use `registerTokenSchema` to attach a schema at the collection level (omit or set `tokenId` to `null`). This supersedes the deprecated `registerCollection` mutation.

<Info>
  Authorization will require the collection/NFT contract owner (or an authorised wallet). Ensure the schema is already created via `createSchema`.
</Info>

### GraphQL Mutation (Collection-Level)

```graphql
mutation RegisterTokenSchema($input: RegisterTokenSchemaInput!) {
  registerTokenSchema(input: $input) {
    tokenSchema {
      id
      collectionId
      tokenId
      schemaId
      version
    }
  }
}
```

Example variables (collection-level):

```json
{
  "input": {
    "collectionId": "1:evm:0x6bca6de2dbdc4e0d41f7273011785ea16ba47182",
    "tokenId": null,
    "schemaId": "http://schema.futureverse.dev/fv#TNLBoxer"
  }
}
```

### Token-Level Override (Optional)

Register a specific token to a different schema (falls back to collection-level if token record absent).

```json
{
  "input": {
    "collectionId": "1:evm:0x6bca6de2dbdc4e0d41f7273011785ea16ba47182",
    "tokenId": "1234",
    "schemaId": "http://schema.futureverse.dev/fv#TNLBoxerVariant"
  }
}
```

### Response Shape

On success:

```json
{
  "data": {
    "registerTokenSchema": {
      "tokenSchema": {
        "collectionId": "1:evm:0x6bca6de2dbdc4e0d41f7273011785ea16ba47182",
        "tokenId": "null",
        "schemaId": "http://schema.futureverse.dev/fv#TNLBoxer",
        "version": 1
      }
    }
  }
}
```

## Register Off-Chain Asset With Schema

After creating (or ensuring the existence of) an off-chain asset via `registerOffChainAsset`, link its **collection** (or optionally a specific off-chain NFT token) to a schema using the *same* `registerTokenSchema` mutation. Off-chain collection IDs use the pattern:

`off-chain:{creatorId}:{creatorCollectionId}` (collection-wide)

and individual NFT tokens may add a token segment when referencing the asset itself, but schema linkage for token-level overrides still supplies the collection ID plus a tokenId value (mirroring on-chain semantics).

<Info>
  You do NOT register schema linkage with the full `did:fv-asset:off-chain:...` DID. Use the raw off-chain collection ID (`off-chain:...:...`) and, for token-level overrides, the `tokenId` you used during `registerOffChainAsset`.
</Info>

### Off-Chain Collection-Level Schema Link

```graphql
mutation RegisterTokenSchema($input: RegisterTokenSchemaInput!) {
  registerTokenSchema(input: $input) {
    tokenSchema { collectionId tokenId schemaId version }
  }
}
```

Example variables:

```json
{
  "input": {
    "collectionId": "off-chain:eb117567-e455-4abd-b8e1-a7e451b96b23:20001",
    "tokenId": null,
    "schemaId": "http://schema.futureverse.dev/example#OffChainAvatar"
  }
}
```

### Off-Chain Token-Level Override (Optional)

If a specific off-chain NFT (with `tokenId`) requires a divergent schema:

```json
{
  "input": {
    "collectionId": "off-chain:eb117567-e455-4abd-b8e1-a7e451b96b23:20001",
    "tokenId": "1",
    "schemaId": "http://schema.futureverse.dev/example#OffChainAvatarVariant"
  }
}
```

For full off-chain asset registration details, see the dedicated [Off-Chain Assets](/asset-register/guides/off-chain-assets) guide.

***

## (Deprecated) Previous Method

`registerCollection` is deprecated and will be / has been removed. Use `registerTokenSchema` for all new integrations.
