Metadata
Metadata allows you to attach custom key-value pairs to certain objects in the Domain Chief API. This is useful for storing additional information or associating your own identifiers with Domain Chief resources.
Supported Objects
Metadata can be attached to the following objects:
- Domains - When registering or updating a domain
- Contacts - When creating or updating a contact
- DNS Records - When creating or updating a DNS record
Use Cases
Metadata is particularly useful for:
- Storing your internal identifiers or reference numbers
- Tagging resources for organizational purposes
- Tracking additional information not captured by standard fields
- Integrating Domain Chief with your own systems
Adding Metadata
Metadata is provided as a JSON object where keys and values must be strings. You can include metadata when creating or updating supported objects.
Example: Registering a Domain with Metadata
Code
Example: Creating a Contact with Metadata
Code
Example: Creating a DNS Record with Metadata
Code
Updating Metadata
When updating an object, the metadata you provide is merged with existing metadata, not replaced entirely.
Adding or Updating a Metadata Key
To add a new key or update an existing one, simply include it in the metadata object:
Code
Removing a Specific Metadata Key
To remove a specific metadata key, set its value to an empty string:
Code
Removing All Metadata
To remove all metadata from an object, set the metadata field to an empty object:
Code
Limitations
The following limitations apply to metadata:
Keys
- Must be strings
- Cannot exceed 40 characters
- Cannot contain [or]characters
Values
- Must be strings
- Cannot exceed 500 characters
Total Keys
- An object cannot have more than 50 metadata keys
Validation Examples
Valid Metadata
Code
Invalid Metadata
The following examples show invalid metadata that will be rejected by the API:
Key contains [ or ] characters:
Code
Value is not a string:
Code
Retrieving Metadata
When you retrieve an object that has metadata, it will be included in the response as a metadata field:
Code
If an object has no metadata, the metadata field will be an empty object {}.
UI Integration
Metadata is displayed in the Domain Chief web interface with special handling for certain values.
URLs
When a metadata value contains a valid URL (starting with https://), it will automatically become clickable in the Domain Chief UI, making it easy to navigate to external resources.
Example:
Code
Special Metadata Keys for Domains
The external_url metadata key has special meaning when set on a domain. It will display a prominent button in the Domain Chief UI, providing quick access to the external resource.
Example:
Code
This is particularly useful for linking domains to external management tools, customer portals, or related resources.
Best Practices
- Use descriptive keys - Choose clear, meaningful key names that make it easy to understand what each metadata entry represents.
- Keep values concise - While values can be up to 500 characters, shorter values are easier to work with and display.
- Use consistent naming - Establish a naming convention for your metadata keys (e.g., snake_case, camelCase) and stick to it.
- Don't store sensitive data - Metadata is stored as plain text and may be visible in logs and API responses. Don't use it for passwords, API keys, or other sensitive information.
- Plan your key structure - With a limit of 50 keys per object, think about how you'll organize your metadata to stay within this limit.
