Tags
To help you manage, categorize and enrich resources, Unit allows you to attach your own metadata to them in the form of tags (key-value pairs). Common examples:
- Attaching a
my_customer_idtag to an application with a value that helps you connect the application to a unique customer identifier in your app. - Attaching a
purposetag to an account with a value such astax,savingorchecking.
{
"data": {
"type": "depositAccount",
"attributes": {
/// ...
"tags": {
"purpose": "tax",
"my_account_id": "b6f395c9-e58a-40a5-a5a4-901d603440b9"
}
},
/// ...
}
Tag Inheritance
Some resources are created as a result of you creating a parent resource (customer and application respectively). They therefore inherit all tags from their parent resource, as specified in the table below.
Tag Support
| Resource Type | Tag Support | Inherited From |
|---|---|---|
| Applications | Yes | Application Form |
| Application Forms | Yes | |
| Authorizations | Yes | Authorization Request |
| Authorization Requests | Yes | |
| Cards | Yes | |
| Check Deposits | Yes | |
| Counterparties | Yes | |
| Customers | Yes | Application |
| Deposit Accounts | Yes | |
| Credit Accounts | Yes | |
| Fees | Yes | |
| Payments | Yes | |
| Repayments | Yes | |
| Statements | No | |
| Transactions | Yes | Payment, Authorization Request |
Searching by Tags
The List operation under certain resources (such as Application, Customer or Payment) supports searching by tags. You can search by passing any number of key-value pairs. The response will include the resources whose tags contain the key-value pairs you specified, based on the principles of JSON containment.
Example uses:
- Assume you attach 5 different tags to all applications you create on Unit. One of these tags is a
my_customer_idtag that helps you connect every Unit application to a unique customer identifier in your app. To search for the application that belongs to a known customer, specify a key-value pair in the following way:{ "my_customer_id": "b6f395c9-e58a-40a5-a5a4-901d603440b9" } - Assume you attach 4 different tags to all book transfers you create on Unit. Two of these tags are
is_loanandnumber_of_repayments. To search for all loans that have four repayments, specify two key-value pairs in the following way:{ "is_loan": "true", "number_of_repayments": "4" }
Updating Tags
You can add, update or delete tags from resources with the tags attribute on their corresponding Update operation (for example, Update Deposit Account).
Unit follows the JSON Merge Patch RFC when updating the tags. In general:
- To add or update a tag, specify its key and value.
- To delete a tag, specify its key and
nullfor the value.
Tag Constraints
- Maximum number of tags per resource: 30
- Keys and values are case-sensitive
- Key constraints: 128 characters consisting of letters, numbers and underscores
- Value constraints: 256 characters