Create an AI label rule
/ai-label-rulesCreates the AI label and the natural-language condition that applies it, in one call.
Setting autoReplyEnabled: true lets Maylee send replies on your behalf: it requires allowOutboundSend on the key, like sending an email does.
Authorization
apiKey Send your key as Authorization: Bearer mk_…. Session cookies are never accepted on this surface.
In: header
Header Parameters
A unique value per operation, such as a UUID. Replays the stored response for 24h. Reusing a key with a different body returns 409.
length <= 255Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/ai-label-rules" \ -H "Authorization: Bearer $MAYLEE_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "color": "Green", "condition": "The email is an invoice, a receipt or a payment confirmation from a supplier.", "hideFromInbox": true, "name": "Invoices" }'{ "rule": { "autoDraftEnabled": true, "autoReplyConfidenceThreshold": 85, "autoReplyDelayMinutes": 0, "autoReplyEnabled": false, "autoReplyNotifyOnSend": true, "condition": "The sender asks about pricing, a quote or a demo of our product.", "createdAt": "2026-06-03T08:00:00.000Z", "hideFromInbox": false, "id": "cmrl1a2b3c4d5e6f7g8h9i0j", "label": { "color": "Blue", "id": "cmtgai1b2c3d4e5f6g7h8i9j", "isAiLabel": true, "name": "Sales" }, "updatedAt": "2026-08-20T16:40:00.000Z" }}Get an AI label rule GET
Previous Page
Classify existing emails with the AI label rules POST
Rules only apply to emails synchronized after their creation. This queues one background job per active mailbox (or the given one) that classifies the `limit` most recent INBOX emails with every rule of the workspace. Labels land asynchronously: they appear in the `tags` of each email once it is classified. A backfill applies labels and nothing else: no auto-forward, auto-draft or auto-reply is triggered. Each classified email costs one model call.