Overview
Some objects in Tesouro can have custom tags assigned to them, such as “Travel expenses” or “Events”. Tags are useful for improving organization, reporting, and workflows by enabling detailed categorization and tracking. You can assign tags to:- Accounts payable documents: payables, credit notes (in any status)
- Accounts receivable documents: invoices, quotes, credit notes (in any status)
- Counterparts
- Projects
Marketing and marketing are two different tags.
Tags can optionally have a category and description. The available categories are document_type, department, project, cost_center, vendor_type, payment_method, and approval_status.
Roles and permissions
To create and manage tags using an organization user token, this organization user must have a role with thetag permission.
If a partner-level token is used, no special permissions are needed.
Create a tag
Before you can add tags to an object, you need to create these tags in Tesouro. To create a tag, callPOST /tags:
Assign tags to an object
You can assign tags to objects both when creating new objects and updating existing objects. Provide the tag IDs in thetag_ids list in the request body of the create or update request.
Some examples:
- Payable
- Receivables: create invoice
- Receivables: update invoice
- Counterpart
Tag auto-assignment for payables
You can define sets of specific tags to be automatically assigned to new payables created via OCR. This feature must be enabled via the organization settingpayables_ocr_auto_tagging.
Additionally, you must specify a set of keywords that Tesouro will use to search within the created payables. Tesouro searches by substring and is case-insensitive. When one of these keywords is detected during the OCR process, the corresponding tag will be automatically assigned to the payable:
Tag auto-assignment only applies to payables successfully scanned by the OCR. When manually
creating or editing a payable, the tags are not added automatically.
Find and filter objects by tags
When querying taggable objects, you can provide a list of tags to use as a filter.-
/payablesand/payable-credit-notesendpoints support thetag_idsfilter that works as OR.GET /payables?tag_ids=TAG_1&tag_ids=TAG_2returns payables that contain at least one of TAG_1 or TAG_2.
-
/receivablesendpoints support thetag_ids(AND) andtag_ids__in(OR) filters.GET /receivables?tag_ids=TAG_1&tag_ids=TAG_2returns receivables that contain both TAG_1 and TAG_2.GET /receivables?tag_ids__in=TAG_1&tag_ids__in=TAG_2returns receivables that contain at least one of TAG_1 or TAG_2.
-
GET /counterpartssupports thetag_ids__infilter that works as OR.
List all tags
To list all existing tags, callGET /tags:
Update a tag
You can rename existing tags as well as change their category and description. To update a tag, callPATCH /tags/{tag_id} and provide the new values in the request body:
Delete a tag
CallDELETE /tags/{tag_id} to delete an existing tag by its ID. This tag will be automatically deleted from all objects where it is used.