/** * @example * { * object_type: "vehicle", * records: [{ * associations: [{ * object_type: "garage", * action: "link", * records: [{ * identifiers: { * id: 435435 * } * }] * }, { * object_type: "garage", * action: "unlink", * records: [{ * identifiers: { * ext_id: "old-garage-001" * } * }] * }], * attributes: { * "make": "Toyota", * "model": "Camry", * "year": 2020, * "engine_type": "hybrid" * }, * identifiers: { * ext_id: "VIN123" * } * }] * } * * @example * { * object_type: "vehicle", * records: [{ * attributes: { * "make": "Honda", * "model": "Civic", * "year": 2023, * "engine_type": "petrol" * } * }] * } * * @example * { * object_type: "vehicle", * records: [{ * attributes: { * "color": "red", * "engine_type": "diesel" * }, * identifiers: { * id: 42 * } * }] * } */ export interface UpsertrecordsRequest { /** Object type for the records to upsert. Must be a previously created custom object type. Only lowercase alphanumeric characters and underscores are allowed (max 32 characters). */ object_type: string; /** List of object records to be upsert. Each record can have attributes, identifiers, and associations. */ records: UpsertrecordsRequest.Records.Item[]; } export declare namespace UpsertrecordsRequest { type Records = Records.Item[]; namespace Records { interface Item { /** List of associations for the object record. Maximum 20 total entries allowed, with a maximum of 10 link actions and 10 unlink actions. Each entry specifies an object_type and an action (link or unlink). Unlink is idempotent — removing a non-existing association does not return an error. Both associated records must already exist before creating a link. */ associations?: Item.Associations.Item[] | undefined; /** * Key-value pairs of attribute data for the object record. Each key must be the attribute **key** (e.g., `company_name`, `engine_type`), not the attribute label (e.g., "Company Name", "Engine Type"). Only attributes that already exist in the object schema will be accepted — unknown keys are silently ignored. Minimum 1 attribute is required. * * For `category` or `multiple_category` attributes, set the value to the option **key** (not the option label or option ID). You can find available option keys in the `options` array returned by the GET attributes endpoint, or in the frontend under each attribute's settings. * * For example, use the option key "hybrid" not the label "Hybrid" — using the label will be silently ignored. * * For `multiple_choice` type, pass an **array of option keys** (not display labels). For example, if options have keys `"sunroof"` and `"leather_seats"`, pass `["sunroof", "leather_seats"]`. */ attributes?: Record | undefined; /** * Identifiers for the object record. Supports `id` (singular, not `ids`) or `ext_id`. * - `ext_id`: Your external system's identifier for this record. * - `id`: Internal Brevo record ID — can only be used for **updating** existing records, not for creation. * NOTE: * - This is an optional field. If no identifier is provided, Brevo auto-generates an internal ID that you can use for future operations. * - If both `ext_id` and `id` are provided, `id` takes precedence and the operation is treated as an update. It is recommended to provide only one identifier per record. */ identifiers?: Item.Identifiers | undefined; } namespace Item { type Associations = Associations.Item[]; namespace Associations { interface Item { /** Type of the associated object */ object_type: string; /** Action to perform on the association. - `link`: Create association between records (default if not provided) - `unlink`: Remove association between records. Idempotent — unlinking a non-existing association is a no-op success. */ action?: Item.Action | undefined; records: Item.Records.Item[]; } namespace Item { /** Action to perform on the association. - `link`: Create association between records (default if not provided) - `unlink`: Remove association between records. Idempotent — unlinking a non-existing association is a no-op success. */ const Action: { readonly Link: "link"; readonly Unlink: "unlink"; }; type Action = (typeof Action)[keyof typeof Action]; type Records = Records.Item[]; namespace Records { interface Item { /** Identifiers for the associated object record. Provide either `ext_id` or `id`. */ identifiers?: Item.Identifiers | undefined; } namespace Item { /** * Identifiers for the associated object record. Provide either `ext_id` or `id`. */ interface Identifiers { /** External ID of the associated record in your system. */ ext_id?: string | undefined; /** Internal ID of the associated object record generated by Brevo. */ id?: number | undefined; } } } } } /** * Identifiers for the object record. Supports `id` (singular, not `ids`) or `ext_id`. * - `ext_id`: Your external system's identifier for this record. * - `id`: Internal Brevo record ID — can only be used for **updating** existing records, not for creation. * NOTE: * - This is an optional field. If no identifier is provided, Brevo auto-generates an internal ID that you can use for future operations. * - If both `ext_id` and `id` are provided, `id` takes precedence and the operation is treated as an update. It is recommended to provide only one identifier per record. */ interface Identifiers { /** ext_id is ID of record in the external system that client wants to store in the object system. */ ext_id?: string | undefined; /** Internal ID of the object record generated by Brevo */ id?: number | undefined; } } } }