Skip to main content

Assign & Query Attributes

Manage verifiable labels and attestations tied to addresses for policy enforcement and access control.

Query Attributes

Get Specific Attribute

Check for a specific attribute on an address:

Code snippet
curl -H "Authorization: Bearer $PROV_API_TOKEN" \
"https://api.provlabs.com/provenance/attribute/v1/attribute/pb1ADDRESS.../pio.kyc.verified"

List All Attributes

Get all attributes for an address:

Code snippet
curl -H "Authorization: Bearer $PROV_API_TOKEN" \
"https://api.provlabs.com/provenance/attribute/v1/attribute/pb1ADDRESS..."

Find Accounts by Attribute

Get all accounts that have a specific attribute:

Code snippet
curl -H "Authorization: Bearer $PROV_API_TOKEN" \
"https://api.provlabs.com/provenance/attribute/v1/accounts/pio.kyc.verified"

Scan by Suffix

Find attributes matching a suffix pattern:

Code snippet
curl -H "Authorization: Bearer $PROV_API_TOKEN" \
"https://api.provlabs.com/provenance/attribute/v1/attribute/pb1ADDRESS.../scan/kyc"

Assign Attributes

Add Attribute (Transaction)

Build and broadcast an attribute addition transaction:

  1. Build Tx in Vault: Use MsgAddAttribute
  2. Sign locally with your key
  3. Broadcast via Node RPC
  4. Verify with read endpoints

Example transaction structure:

Response
{
"messages": [
{
"@type": "/provenance.attribute.v1.MsgAddAttribute",
"name": "pio.kyc.verified",
"value": "true",
"attribute_type": "ATTRIBUTE_TYPE_STRING",
"account": "pb1ADDRESS...",
"owner": "pb1ADDRESS..."
}
]
}

Remove Attribute (Transaction)

Build and broadcast an attribute removal transaction:

  1. Build Tx in Vault: Use MsgDeleteAttribute
  2. Sign locally with your key
  3. Broadcast via Node RPC
  4. Verify with read endpoints

Example transaction structure:

Response
{
"messages": [
{
"@type": "/provenance.attribute.v1.MsgDeleteAttribute",
"name": "pio.kyc.verified",
"account": "pb1ADDRESS...",
"owner": "pb1ADDRESS..."
}
]
}

Verify Changes

After adding or removing attributes, verify the changes:

Check Specific Attribute

Code snippet
curl -H "Authorization: Bearer $PROV_API_TOKEN" \
"$PROV_REST_BASE/provenance/attribute/v1/attribute/pb1ADDRESS.../pio.kyc.verified"

List All Attributes

Code snippet
curl -H "Authorization: Bearer $PROV_API_TOKEN" \
"$PROV_REST_BASE/provenance/attribute/v1/attribute/pb1ADDRESS..."

Check Allow-list

Code snippet
curl -H "Authorization: Bearer $PROV_API_TOKEN" \
"$PROV_REST_BASE/provenance/attribute/v1/accounts/pio.kyc.verified"

Common Use Cases

KYC Verification

Code snippet
# Check if user has KYC
curl -H "Authorization: Bearer $PROV_API_TOKEN" \
"https://api.provlabs.com/provenance/attribute/v1/attribute/pb1ADDRESS.../pio.kyc.verified"

# Add KYC attribute
# (Build transaction in Vault, sign, broadcast)

Compliance Tracking

Code snippet
# Check compliance status
curl -H "Authorization: Bearer $PROV_API_TOKEN" \
"https://api.provlabs.com/provenance/attribute/v1/attribute/pb1ADDRESS.../scan/compliance"

# Find all compliant users
curl -H "Authorization: Bearer $PROV_API_TOKEN" \
"https://api.provlabs.com/provenance/attribute/v1/accounts/pio.compliance.verified"

Access Control

Code snippet
# Check if user has admin privileges
curl -H "Authorization: Bearer $PROV_API_TOKEN" \
"https://api.provlabs.com/provenance/attribute/v1/attribute/pb1ADDRESS.../pio.admin.verified"

# Find all admin users
curl -H "Authorization: Bearer $PROV_API_TOKEN" \
"https://api.provlabs.com/provenance/attribute/v1/accounts/pio.admin.verified"

Error Handling

Attribute Not Found

Error: not_found - Attribute not found

Response:

Response
{
"code": "not_found",
"message": "Attribute not found."
}

Fix: Verify attribute name is correct and exists on the address

Invalid Suffix

Error: invalid_argument - Invalid suffix

Response:

Response
{
"code": "invalid_argument",
"message": "Invalid suffix format."
}

Fix: Use valid suffix pattern (e.g., "kyc", "admin")

No Attributes Found

Error: not_found - No attributes found matching suffix

Response:

Response
{
"code": "not_found",
"message": "No attributes found matching the specified suffix."
}

Fix: Check if address has any attributes with the specified suffix

Best Practices

Attribute Naming

  • Use consistent naming conventions (e.g., pio.kyc.verified)
  • Include organization prefix to avoid conflicts
  • Use descriptive suffixes for different attribute types

Verification Patterns

  • Always verify attribute changes after transactions
  • Use specific attribute checks for access control
  • Use suffix scans for discovery and audit purposes

Error Handling

  • Validate attribute names before making requests
  • Handle not_found responses gracefully
  • Provide clear error messages to users