Skip to main content
POST
/
v1
/
settings
/
metadata-indexes
/
entities
/
{entity_name}
Create a Metadata Index
curl --request POST \
  --url https://ledger.sandbox.lerian.net/v1/settings/metadata-indexes/entities/{entity_name} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: <content-type>' \
  --data '
{
  "metadataKey": "tier",
  "unique": false,
  "sparse": true
}
'
{
"indexName": "metadata.tier_1",
"entityName": "transaction",
"metadataKey": "tier",
"unique": false,
"sparse": true
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

Authorization
string

The authorization token. This header is required if your environment has the Access Manager enabled.

Content-Type
string
required

The type of media of the resource. Must be application/json.

X-Request-Id
string<uuid>

A unique identifier used to trace and track each request.

Path Parameters

entity_name
enum<string>
required

The name of the entity for which the metadata index will be created or managed.

Available options:
organization,
ledger,
asset,
segment,
portfolio,
account,
transaction,
operation,
account_type,
operation_route,
transaction_route

Body

application/json

The request body to create a metadata index.

metadataKey
string
required

The metadata key to be indexed. This key must match the metadata field name used in your entities.

Maximum string length: 100
Example:

"tier"

unique
boolean
default:false

Indicates whether the index enforces uniqueness. When set to true, duplicate values for this metadata key will not be allowed.

Example:

false

sparse
boolean
default:true

Indicates whether the index is sparse. When set to true, only documents containing the indexed field will be included in the index.

Example:

true

Response

Indicates that the metadata index was successfully created and the operation was completed as expected.

The response body for a metadata index.

indexName
string
required

The name of the index in the database.

Example:

"metadata.tier_1"

entityName
string
required

The name of the entity associated with the index.

Example:

"transaction"

metadataKey
string
required

The metadata key used in the index.

Example:

"tier"

unique
boolean
required

Indicates whether the index enforces uniqueness.

Example:

false

sparse
boolean
required

Indicates whether the index is sparse (ignores documents without the indexed field).

Example:

true