Skip to main content
GET
/
api
/
v1
/
attributes
/
{name}
Get Attribute
curl --request GET \
  --url https://api.example.com/api/v1/attributes/{name}
{
  "name": "email",
  "data-format": "string",
  "context-format": null,
  "attestation-required": false
}

Overview

Retrieves detailed information about a specific attribute registered in the BOOP Network. This endpoint is useful for validating attribute configurations and understanding data format requirements.
This endpoint does not require authentication and can be used to verify attribute specifications before making authentication requests.

Path Parameters

name
string
required
The unique name of the attribute to retrieve (e.g., “email”, “age-verify”)

Response

name
string
required
Unique name of the attribute
data-format
string
Format specification for the attribute data (e.g., “string”, “boolean”, “object”)
context-format
string
Format specification for additional context data (optional)
attestation-required
boolean
required
Whether modification of this attribute requires attestation from a trusted entity
{
  "name": "email",
  "data-format": "string",
  "context-format": null,
  "attestation-required": false
}

Usage Examples

async function getAttributeDetails(attributeName) {
  const response = await fetch(
    `https://dev.app.boop.it/api/v1/attributes/${attributeName}`
  );

  if (!response.ok) {
    if (response.status === 404) {
      throw new Error(`Attribute '${attributeName}' not found`);
    }
    throw new Error(`Failed to fetch attribute: ${response.statusText}`);
  }

  return await response.json();
}

// Validate attribute before use
async function validateAttributeRequest(attributeName) {
  try {
    const attr = await getAttributeDetails(attributeName);

    if (attr['attestation-required']) {
      console.warn(`Attribute '${attributeName}' requires attestation`);
    }

    return {
      name: attr.name,
      format: attr['data-format'],
      requiresAttestation: attr['attestation-required']
    };
  } catch (error) {
    console.error(`Invalid attribute: ${error.message}`);
    return null;
  }
}

Attribute Validation

Use this endpoint to validate attributes before authentication requests:
async function validateAuthenticationAttributes(requiredAttributes) {
  const validationResults = await Promise.all(
    requiredAttributes.map(async (attrName) => {
      try {
        const attr = await getAttributeDetails(attrName);
        return {
          name: attrName,
          valid: true,
          requiresAttestation: attr['attestation-required'],
          dataFormat: attr['data-format']
        };
      } catch (error) {
        return {
          name: attrName,
          valid: false,
          error: error.message
        };
      }
    })
  );

  const invalidAttributes = validationResults.filter(result => !result.valid);
  const attestationRequired = validationResults.filter(
    result => result.valid && result.requiresAttestation
  );

  return {
    valid: invalidAttributes.length === 0,
    invalidAttributes,
    attestationRequired,
    validAttributes: validationResults.filter(result => result.valid)
  };
}

// Usage in authentication setup
const validation = await validateAuthenticationAttributes([
  'email', 'age-verify', 'payment-method'
]);

if (!validation.valid) {
  console.error('Invalid attributes:', validation.invalidAttributes);
}

Data Format Examples

String Attributes

{
  "name": "username",
  "data-format": "string",
  "context-format": null,
  "attestation-required": false
}

Boolean Attributes

{
  "name": "marketing-consent",
  "data-format": "boolean",
  "context-format": null,
  "attestation-required": false
}

Object Attributes

{
  "name": "billing-address",
  "data-format": "object",
  "context-format": "json",
  "attestation-required": true
}

Integration Patterns

Dynamic Form Generation

async function buildAttributeForm(attributeNames) {
  const formFields = await Promise.all(
    attributeNames.map(async (name) => {
      const attr = await getAttributeDetails(name);

      return {
        name: attr.name,
        type: attr['data-format'],
        required: true,
        attestationWarning: attr['attestation-required']
      };
    })
  );

  return formFields;
}

Attribute Compatibility Check

async function checkAttributeCompatibility(vendorRequirements) {
  const compatibility = {};

  for (const attrName of vendorRequirements) {
    try {
      const attr = await getAttributeDetails(attrName);
      compatibility[attrName] = {
        supported: true,
        requiresAttestation: attr['attestation-required'],
        dataFormat: attr['data-format']
      };
    } catch (error) {
      compatibility[attrName] = {
        supported: false,
        error: error.message
      };
    }
  }

  return compatibility;
}

Caching Strategy

Since attribute definitions change infrequently, implement caching:
class AttributeCache {
  constructor(ttl = 300000) { // 5 minutes
    this.cache = new Map();
    this.ttl = ttl;
  }

  async get(attributeName) {
    const cached = this.cache.get(attributeName);

    if (cached && Date.now() - cached.timestamp < this.ttl) {
      return cached.data;
    }

    try {
      const data = await getAttributeDetails(attributeName);
      this.cache.set(attributeName, {
        data,
        timestamp: Date.now()
      });
      return data;
    } catch (error) {
      // Cache negative results for shorter time
      this.cache.set(attributeName, {
        data: null,
        timestamp: Date.now(),
        error: error.message
      });
      throw error;
    }
  }
}

Error Handling

Status CodeMeaningHandling
200Attribute foundProcess attribute details
404Attribute not foundCheck spelling, update requirements
500Server errorRetry request, check system status

Rate Limits

  • 1000 requests per minute per IP address
  • No authentication required for this endpoint