Valdyr

Tags

Attach sales, rebate, charge, billing and support data to a subscription, a customer or a license

A tag attaches a typed value to a subscription, a customer or a license for a period. Invoicing, reports and the support team read the tags. For example, a MANUAL_CHARGE tag adds a charge to each invoice while the tag is valid, and a CHURN tag records why the customer left.

The entity of a tag

A tag attaches to exactly one entity. Give exactly one of subscriptionId, customerId and licenseId when you create or list tags. Not every type attaches to every kind of entity. For example, INVOICE_VAT attaches only to a customer, and CHURN does not attach to a customer.

The type decides the value

Each tag has a type. The type decides the shape of the value:

Value shapeFieldExample types
Textvalue, a stringDISCOUNT, DIRECT_SALE, CUSTOM
Numbervalue, a numberREBATE_PERCENTAGE, INVOICE_VAT
Optionvalue, one of the options of the typeCHURN, CALL_SERVICE, PROVISIONING
Flagno valueINVOICE_IGNORE_CUSTOMER
Referencevalue, the identifier of an entityPRICE_LIST, PRODUCT_CATALOG
Manual chargemanualChargeMANUAL_CHARGE
One-time manual chargemanualCharge and chargeDateMANUAL_CHARGE_ONCE

We add new tag types without notice. Your client must accept a type that it does not know. A tag that the API cannot show in its typed form has the type CUSTOM, with the full tag text as the value.

Which types your API key can use

The roles of the API key decide which tag types it can create, end and delete. An environment can also turn off a type for all callers.

  1. Call GET /tag-types with the target of the entity to get the types that your API key can create.
  2. For a type with the value shape OPTION, use one of the options of that type.

The API answers these refusals with a reason:

StatusReasonCondition
403tag_type_not_permittedThe roles of the API key cannot manage the type.
422tag_type_disabledThe environment turned off the type.
422tag_type_not_on_targetThe type does not attach to this kind of entity.
400tag_target_ambiguousThe request names no entity, or more than one.

End or delete

  • To stop a tag, end it with POST /tags/{tagId}/end. The tag stays in the history of its entity. An end can only move the last valid date earlier.
  • To remove a tag that is not correct, delete it with DELETE /tags/{tagId}. An invoice that already includes a charge of the tag does not change.