Requirements
- A company integration with an API client. In Empresa › Integraciones, the administrator grants the Commercial domains the CRM needs.
clients: clients and client groups. It is granted by someone who sees Clients in Masnet; writing (write:clients), by someone who also manages them.sales_portfolios: portfolios, the scope of each person and direct assignments. It is granted by someone who administers portfolios. Its write (write:sales_portfolios) requires thepeoplegroup, because it names people by their email.catalogalso carries the product groups and competitor brands, andbusiness_linesthe business lines with their people and product groups.buyers: the master list of public buyers, read-only, to build portfolios with buyers the company does not have yet. It is granted by someone who sees Tenders in Masnet.- The client authenticates as in the rest of the data API; base:
https://daas.masnet.com/api/v1/integrations.
Initial load
- Write down the time of the first event you receive by webhook.
- Traverse
clientswithoutupdated_since. It carries the whole portfolio, active and archived; filter withadministered=trueif the CRM only wants the clients the company added or already managed. - Traverse
client-groupsand, for each group, itsclient-groups/{id}/clientslist. - Traverse
sales-portfoliosand, for each portfolio, itssales-portfolios/{id}/clientslist. The people of the portfolio come in the object (people). - Traverse
sales-scopesandclient-assignmentsto know what each person sees and whom they serve. - If granted, traverse
product-groups,competitor-marksandbusiness-lines. - Apply the events with a
sequencegreater than theversion(orrow_version) you loaded.
GET /api/v1/integrations/data/client-groups/315/clients?limit=500 HTTP/1.1
Host: daas.masnet.com
Authorization: Bearer <token con read:clients>
HTTP/1.1 200 OK
{
"data": [
{
"client_id": "88123",
"is_primary": true,
"sort_order": 0,
"added_at": "2026-10-02T12:00:00.000Z"
},
{
"client_id": "88401",
"is_primary": false,
"sort_order": 1,
"added_at": "2026-11-26T15:20:07.000Z"
}
],
"next_cursor": null,
"has_more": false
}Member lists accept only limit (maximum 500) and cursor, ordered by client_id. The data API describes each resource and its filters.
Events
They are emitted by the changes the company makes: its people, the spreadsheet import and the integrations. What Masnet calculates from Mercado Público (the classification and market figures of each client) does not emit; it is read with updated_since.
| Type | When it is emitted | Schema |
|---|---|---|
com.masnet.client.added.v1 | The company adds a client to its portfolio, or manages for the first time a buyer that Masnet projected from Mercado Público. | client |
com.masnet.client.updated.v1 | The company changes a published field of a client. The classification and the market figures that Masnet calculates do not emit. | client |
com.masnet.client.archived.v1 | The company archives a client. | client |
com.masnet.client.reactivated.v1 | The company reactivates an archived client. | client |
com.masnet.client_group.changed.v1 | A client group is created, changed, deactivated or reactivated, or its members change (change: members_changed, with the count and the version of the list). A group that becomes private is reported as removed. | client_group |
com.masnet.sales_portfolio.changed.v1 | A portfolio is created, changed, archived or restored, or its clients or sellers change (change: members_changed). | sales_portfolio |
com.masnet.sales_scope.changed.v1 | What a person can see of the portfolio changes (only their clients, their team or both). Requires the people field group. | sales_scope |
com.masnet.client_assignment.changed.v1 | The direct assignment of a client to a person or a team is added or removed. Requires the people field group. | client_assignment |
com.masnet.product_group.changed.v1 | A product group of the catalog is created, changed, deactivated or reactivated. | product_group |
com.masnet.competitor_mark.changed.v1 | A competitor brand of a catalog product is saved, retired or deleted. | competitor_mark |
com.masnet.business_line.changed.v1 | A business line is created, changed, deactivated, reactivated or deleted, or its people or its product groups change. | business_line |
client.addedis also emitted when the company manages for the first time a buyer that Masnet projected from Mercado Público, for example by editing it, grouping it or adding it to a portfolio.- The
.changedevents carrychangewith the fact: for examplecreated,updatedormembers_changed. A client group that becomes private arrives asremoved: delete it from the local copy. com.masnet.sales_scope.changed.v1andcom.masnet.client_assignment.changed.v1require thepeoplegroup: without it they are not delivered.catalog_item.updatedis also emitted when the groups of a product change (group_idsandprimary_group_id).
Member reconciliation
Adding or removing clients of a group or a portfolio produces a single event of the container, even when thousands of rows change. The event carries the count (member_count in groups, client_count and person_count in portfolios) and members_version, not the list.
{
"specversion": "1.0",
"id": "evt_01JDQ4T7M2C8V5R9X3K6N1P0WB",
"type": "com.masnet.client_group.changed.v1",
"source": "https://daas.masnet.com/api/v1/integrations/companies/0b9e3c1a-7d42-4f0e-8a51-6c2b9d4e7f10",
"subject": "client-groups/315",
"time": "2026-11-26T15:20:07.311Z",
"datacontenttype": "application/json",
"dataschema": "https://masnet.com/developers/schemas/client_group/v1.json",
"tenantid": "0b9e3c1a-7d42-4f0e-8a51-6c2b9d4e7f10",
"sequence": 7,
"environment": "production",
"data": {
"object": {
"id": "315",
"version": 7,
"parent_id": null,
"name": "Hospitales zona sur",
"slug": "hospitales-zona-sur",
"description": null,
"color": null,
"icon": null,
"sort_order": 0,
"ranking": {
"tier": null,
"score": null
},
"visibility": "workspace",
"owner_team_id": null,
"status": "active",
"member_count": 42,
"members_version": 4,
"created_at": "2026-10-02T12:00:00.000Z",
"updated_at": "2026-11-20T09:14:52.000Z",
"change": "members_changed"
},
"previous": null,
"changed_fields": [
"member_count",
"members_version"
],
"actor": {
"type": "user"
},
"evidence": "masnet_record"
}
}- Store the
members_versionof each container together with its list. - With
change: members_changed, or ifmembers_versionis greater than the stored one, read the full list and replace the local copy: a client that is not returned left the container. - The lists are
client-groups/{id}/clientsandsales-portfolios/{id}/clients. The people of a portfolio and those of a business line come inside the object and are replaced with it. client_assignment.changedreports each direct assignment withchange: addedorremoved.client-assignmentsdoes not acceptupdated_since: to reconcile, traverse it in full.
Writing clients and portfolios
The CRM writes with POST …/client-operations, with the sheets and columns of the Clients spreadsheet in JSON. Clientes, Grupos and Grupo_Miembros require write:clients; Carteras, Cartera_Vendedores, Cartera_Clientes and Asignaciones require write:sales_portfolios with the people group.
POST /api/v1/integrations/data/client-operations HTTP/1.1
Host: daas.masnet.com
Authorization: Bearer <token>
Content-Type: application/json
{
"schema_version": "commercial-portfolios-exchange.v1",
"client_request_id": "4e8a1f20-7c3b-4d59-a6e2-9b0d1c5f7a38",
"sheets": {
"Carteras": [
{
"cartera": "Sur",
"descripcion": "Hospitales y servicios de salud de la zona sur"
}
],
"Cartera_Vendedores": [
{
"cartera_ref": "Sur",
"correo": "[email protected]",
"accion": "Agregar"
}
],
"Cartera_Clientes": [
{
"cartera_ref": "Sur",
"codigo_unidad": "7248",
"accion": "Agregar"
}
],
"Asignaciones": [
{
"correo": "[email protected]",
"codigo_unidad": "7248",
"accion": "Agregar"
}
]
}
}- Create the operation with a new
client_request_id(UUID). It responds202and Masnet validates it in the background. - Query
GET …/client-operations/{id}untilstatusis no longervalidating. Withready, readGET …/resultsto see each row: its action, its status and, if it is not valid, the code and the column. - Apply with
POST …/applyand thevalidation_tokenof the review. Withabort_on_errorsnothing is applied if any row is invalid; withapply_valid_unitsthe valid ones are applied. - The applied changes emit their events like any change of the company. If the CRM also receives them, discard the ones it already applied by comparing
sequencewith the version it holds.
A test integration creates and queries operations as a simulation, without applying them. The detail of the body, the columns of each sheet, the statuses and the errors is in Client and portfolio operations.
Build portfolios from the master list
buyers is the master list of public buyers in Mercado Público: every branch (purchasing unit), not only those in the company portfolio. It is read with read:buyers, only with the public group, and it is granted by someone who sees Tenders in Masnet.
| Field | What it is |
|---|---|
id | Masnet id of the branch. It is the same buyer.id that each client carries. |
rut | RUT (tax id) of the buyer organization, shared by all its branches. |
name | Name of the buyer organization. |
branch_name | Name of the branch; null when it repeats the organization name. |
region | Short region name, for example METROPOLITANA or V VALPARAISO; null when Mercado Público does not report it. |
commune | Commune, or null. |
GET /api/v1/integrations/data/buyers?limit=500 HTTP/1.1
Host: daas.masnet.com
Authorization: Bearer <token con read:buyers>
HTTP/1.1 200 OK
{
"data": [
{
"id": "7184",
"rut": "61.608.700-2",
"name": "Servicio de Salud Ñuble",
"branch_name": "Hospital Clínico Herminda Martín",
"region": "XVI ÑUBLE",
"commune": "CHILLAN"
},
{
"id": "9032",
"rut": "61.608.700-2",
"name": "Servicio de Salud Ñuble",
"branch_name": null,
"region": null,
"commune": null
}
],
"next_cursor": "<cursor>",
"has_more": true
}- Download the whole master list by traversing
buyerswithoutupdated_since, withlimit=500, and store it in the CRM. - Once a day, traverse it with
updated_sinceset to the time the previous traversal started: it carries only the branches that changed. - Search and filter in your copy. The resource accepts no filters and no
GET /data/buyers/{id}: this way the query to Masnet is always the same ordered list. - To put a branch in the client list, in a group or in a portfolio, send its
idin theid_unidadcolumn of theClientes,Grupo_Miembros,Cartera_ClientesorAsignacionessheets ofclient-operations. It replacesrutandcodigo_unidad, which are not enough when a RUT has many branches.
The master list emits no events: its changes come from Mercado Público, not from an action of the company.
Schemas
- commercial-portfolios-exchange.v1: the body of
POST …/client-operations. - commercial-operation.v1: the operation (
$defs/operation) and its results page ($defs/resultsPage). - The
dataschemaof the events: client, client_group, sales_portfolio, sales_scope, client_assignment, product_group, competitor_mark, business_line.