← Gmail Cleanup
Your token

Gmail Cleanup API

Reading the .mbox file, the sender list, the Gmail searches and every download run free in the browser and need no API. The API is for the one metered step: send your biggest senders with the numbers the page measured, and get back, as JSON ids, a kind, an action (keep, unsubscribe, delete old mail, delete all, or look yourself) and up to three reasons for each. The page builds this input from your mailbox and checks every answer before showing it.

Base URL: https://api.skillsafe.ai/v1/app-api. Every response is {"data": ...} or {"error": {"code", "message"}}; read error.code and error.message rather than the HTTP status alone.

The task field

This app has one task. Always send "task": "sort".

taskWhat it doesReply
sortGives every sender sent a kind, one action and 1 to 3 reasons, following the visitor's note and fixed defaults.One JSON object

Input fields

Every field is a string; facts holds JSON text. task and facts are required; note may be empty.

FieldMeaning
task"sort"
noteWhat to keep or clear, in the visitor's words, up to 300 characters, for example keep receipts and school mail.
factsJSON object: emails_counted, mb_counted, senders_counted, senders_sent, range, and senders, up to 60, each {id, sender, name, emails, mb, last, gmail_category, category_share, has_unsubscribe, one_click, high_volume, large_storage, mostly_promotions, stopped, subjects}.

The reply

job.output.output is text holding one JSON object: senders, a list of {id, kind, action, why}. Kinds: newsletter, promotion, social, receipt_order, account_alert, bill_finance, travel_booking, work_business, personal, other. Actions: keep, unsubscribe, delete_old, delete_all, review. Reasons: has_unsubscribe, high_volume, large_storage, mostly_promotions, stopped, note_keep, note_drop, transactional, personal_sender, bulk_sender. Before using it, check it as the page does: every id was sent and appears once; unsubscribe only where has_unsubscribe is true and stopped is false; no delete_all for personal, work_business, bill_finance or receipt_order; a measured reason only where that field is true; a note reason only with a note. If the balance ran low, truncated is true and the list may stop early; the page keeps the entries that arrived whole.

Worked example

Input (input.json), from the page's "Home inbox, 3 years" example with the note "Keep anything from the school and from my family. I never read the shop emails.":

{
  "task": "sort",
  "note": "Keep anything from the school and from my family. I never read the shop emails.",
  "facts": "{\"emails_counted\":1807,\"mb_counted\":58.3,\"senders_counted\":152,\"senders_sent\":60,\"range\":\"all mail\",\"senders\":[{\"id\":\"s1\",\"sender\":\"briefing@dailyledger.example\",\"name\":\"The Daily Ledger\",\"emails\":300,\"mb\":3.8,\"last\":\"2026-11\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":true,\"large_storage\":true,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Morning briefing\",\"The week in charts\"]},{\"id\":\"s2\",\"sender\":\"deals@brightmart.example\",\"name\":\"Brightmart\",\"emails\":260,\"mb\":6.8,\"last\":\"2026-11\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":true,\"large_storage\":true,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Weekend deals up to 40% off\",\"Café week: 20% off coffee makers\"]},{\"id\":\"s3\",\"sender\":\"notify@friendsnet.example\",\"name\":\"Friendsnet\",\"emails\":220,\"mb\":1.6,\"last\":\"2026-11\",\"gmail_category\":\"social\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":false,\"high_volume\":true,\"large_storage\":true,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"See what friends shared this week\",\"Someone mentioned you in a comment\"]},{\"id\":\"s4\",\"sender\":\"letters@figandfern.example\",\"name\":\"Fig & Fern\",\"emails\":150,\"mb\":2.2,\"last\":\"2026-11\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":true,\"large_storage\":true,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"The Weekly Fig: compost, honestly\",\"The Weekly Fig: seed swaps\"]},{\"id\":\"s5\",\"sender\":\"hello@lumenoutfitters.example\",\"name\":\"Lumen Outfitters\",\"emails\":140,\"mb\":2.9,\"last\":\"2026-11\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":false,\"high_volume\":true,\"large_storage\":true,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Last call: winter coats\",\"Picked for you\"]},{\"id\":\"s6\",\"sender\":\"alerts@northbank.example\",\"name\":\"North Bank Alerts\",\"emails\":90,\"mb\":0.4,\"last\":\"2026-11\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":true,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Card payment over your alert amount\",\"Your balance alert\"]},{\"id\":\"s7\",\"sender\":\"news@trailheadjournal.example\",\"name\":\"Trailhead Journal\",\"emails\":80,\"mb\":1.3,\"last\":\"2025-09\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":true,\"large_storage\":true,\"mostly_promotions\":true,\"stopped\":true,\"subjects\":[\"Our last issue of the season\",\"New trails this month\"]},{\"id\":\"s8\",\"sender\":\"office@oakridge-school.example\",\"name\":\"Oakridge School Office\",\"emails\":70,\"mb\":16.4,\"last\":\"2026-11\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":false,\"high_volume\":true,\"large_storage\":true,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Weekly school newsletter\",\"Trip permission slip\"]},{\"id\":\"s9\",\"sender\":\"orders@shopnest.example\",\"name\":\"ShopNest Orders\",\"emails\":45,\"mb\":0.7,\"last\":\"2026-11\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":true,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Your order has shipped\",\"Your return has been received\"]},{\"id\":\"s10\",\"sender\":\"statements@northbank.example\",\"name\":\"North Bank\",\"emails\":36,\"mb\":6.6,\"last\":\"2026-11\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":true,\"large_storage\":true,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Your monthly statement is ready\"]},{\"id\":\"s11\",\"sender\":\"sam.rivera@mail.example\",\"name\":\"Sam Rivera\",\"emails\":25,\"mb\":0.1,\"last\":\"2026-11\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":true,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Re: moving help\",\"Concert tickets\"]},{\"id\":\"s12\",\"sender\":\"rosa.delgado@mail.example\",\"name\":\"Rosa Delgado\",\"emails\":22,\"mb\":12.2,\"last\":\"2026-11\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":true,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Re: lunch next week\",\"Pictures from the garden\"]},{\"id\":\"s13\",\"sender\":\"ravi.castell@mail.example\",\"name\":\"Ravi Castell\",\"emails\":8,\"mb\":0,\"last\":\"2025-03\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Re: next week\",\"Hello!\"]},{\"id\":\"s14\",\"sender\":\"tomas.castell@mail.example\",\"name\":\"Tomas Castell\",\"emails\":8,\"mb\":0,\"last\":\"2025-09\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Re: next week\",\"Hello!\"]},{\"id\":\"s15\",\"sender\":\"hello@copperfitness.example\",\"name\":\"Copperfitness Club\",\"emails\":7,\"mb\":0.1,\"last\":\"2026-03\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"News from the club\",\"Monthly update\"]},{\"id\":\"s16\",\"sender\":\"no-reply@quillfitness.example\",\"name\":\"Quillfitness\",\"emails\":7,\"mb\":0,\"last\":\"2026-03\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Confirm your email address\",\"Your password was changed\"]},{\"id\":\"s17\",\"sender\":\"lena.castell@mail.example\",\"name\":\"Lena Castell\",\"emails\":7,\"mb\":0,\"last\":\"2026-08\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Following up\",\"Hello!\"]},{\"id\":\"s18\",\"sender\":\"mina.castell@mail.example\",\"name\":\"Mina Castell\",\"emails\":7,\"mb\":0,\"last\":\"2025-10\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Re: next week\",\"Hello!\"]},{\"id\":\"s19\",\"sender\":\"news@quillfoods.example\",\"name\":\"Quillfoods\",\"emails\":6,\"mb\":0.1,\"last\":\"2026-09\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Members-only offer\",\"Welcome! Here is 10% off\"]},{\"id\":\"s20\",\"sender\":\"hello@harborevents.example\",\"name\":\"Harborevents Club\",\"emails\":6,\"mb\":0.1,\"last\":\"2025-11\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"News from the club\",\"Monthly update\"]},{\"id\":\"s21\",\"sender\":\"hello@northmarket.example\",\"name\":\"Northmarket Club\",\"emails\":6,\"mb\":0.1,\"last\":\"2025-08\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Monthly update\",\"News from the club\"]},{\"id\":\"s22\",\"sender\":\"kai.oduya@mail.example\",\"name\":\"Kai Oduya\",\"emails\":6,\"mb\":0,\"last\":\"2024-03\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Re: next week\",\"Re: quick question\"]},{\"id\":\"s23\",\"sender\":\"lena.ibarra@mail.example\",\"name\":\"Lena Ibarra\",\"emails\":6,\"mb\":0,\"last\":\"2026-04\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Re: quick question\",\"Hello!\"]},{\"id\":\"s24\",\"sender\":\"priya.brannigan@mail.example\",\"name\":\"Priya Brannigan\",\"emails\":6,\"mb\":0,\"last\":\"2025-12\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Re: next week\",\"Following up\"]},{\"id\":\"s25\",\"sender\":\"tomas.mensah@mail.example\",\"name\":\"Tomas Mensah\",\"emails\":6,\"mb\":0,\"last\":\"2025-01\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Hello!\",\"Following up\"]},{\"id\":\"s26\",\"sender\":\"news@harborbooks.example\",\"name\":\"Harborbooks\",\"emails\":5,\"mb\":0.1,\"last\":\"2026-08\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Our autumn picks\",\"Members-only offer\"]},{\"id\":\"s27\",\"sender\":\"news@quilltickets.example\",\"name\":\"Quilltickets\",\"emails\":5,\"mb\":0.1,\"last\":\"2025-07\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":true,\"subjects\":[\"Our autumn picks\",\"Members-only offer\"]},{\"id\":\"s28\",\"sender\":\"news@orbitfoods.example\",\"name\":\"Orbitfoods\",\"emails\":5,\"mb\":0.1,\"last\":\"2025-02\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":true,\"subjects\":[\"Members-only offer\",\"Our autumn picks\"]},{\"id\":\"s29\",\"sender\":\"news@silvermarket.example\",\"name\":\"Silvermarket\",\"emails\":5,\"mb\":0.1,\"last\":\"2026-05\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":true,\"subjects\":[\"Our autumn picks\",\"Members-only offer\"]},{\"id\":\"s30\",\"sender\":\"hello@pinefitness.example\",\"name\":\"Pinefitness Club\",\"emails\":5,\"mb\":0.1,\"last\":\"2024-03\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"News from the club\",\"Monthly update\"]},{\"id\":\"s31\",\"sender\":\"no-reply@summitfoods.example\",\"name\":\"Summitfoods\",\"emails\":5,\"mb\":0,\"last\":\"2026-09\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Your booking confirmation\",\"Confirm your email address\"]},{\"id\":\"s32\",\"sender\":\"no-reply@quillbooks.example\",\"name\":\"Quillbooks\",\"emails\":5,\"mb\":0,\"last\":\"2026-06\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Your password was changed\",\"Your booking confirmation\"]},{\"id\":\"s33\",\"sender\":\"no-reply@northmarket.example\",\"name\":\"Northmarket\",\"emails\":5,\"mb\":0,\"last\":\"2026-11\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Confirm your email address\",\"Your booking confirmation\"]},{\"id\":\"s34\",\"sender\":\"kai.sato@mail.example\",\"name\":\"Kai Sato\",\"emails\":5,\"mb\":0,\"last\":\"2025-02\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Hello!\",\"Following up\"]},{\"id\":\"s35\",\"sender\":\"owen.sato@mail.example\",\"name\":\"Owen Sato\",\"emails\":5,\"mb\":0,\"last\":\"2024-07\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Re: next week\",\"Re: quick question\"]},{\"id\":\"s36\",\"sender\":\"kai.castell@mail.example\",\"name\":\"Kai Castell\",\"emails\":5,\"mb\":0,\"last\":\"2026-09\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Following up\",\"Hello!\"]},{\"id\":\"s37\",\"sender\":\"news@lanternpets.example\",\"name\":\"Lanternpets\",\"emails\":4,\"mb\":0.1,\"last\":\"2025-07\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":true,\"subjects\":[\"Welcome! Here is 10% off\",\"Members-only offer\"]},{\"id\":\"s38\",\"sender\":\"news@pineprint.example\",\"name\":\"Pineprint\",\"emails\":4,\"mb\":0.1,\"last\":\"2026-10\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Welcome! Here is 10% off\"]},{\"id\":\"s39\",\"sender\":\"news@quillprint.example\",\"name\":\"Quillprint\",\"emails\":4,\"mb\":0.1,\"last\":\"2025-09\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":true,\"subjects\":[\"Welcome! Here is 10% off\",\"Our autumn picks\"]},{\"id\":\"s40\",\"sender\":\"news@ambergames.example\",\"name\":\"Ambergames\",\"emails\":4,\"mb\":0.1,\"last\":\"2026-08\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Our autumn picks\",\"Members-only offer\"]},{\"id\":\"s41\",\"sender\":\"news@summittravel.example\",\"name\":\"Summittravel\",\"emails\":4,\"mb\":0.1,\"last\":\"2026-04\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":true,\"subjects\":[\"Our autumn picks\",\"Welcome! Here is 10% off\"]},{\"id\":\"s42\",\"sender\":\"hello@meadowbooks.example\",\"name\":\"Meadowbooks Club\",\"emails\":4,\"mb\":0.1,\"last\":\"2024-10\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Monthly update\",\"News from the club\"]},{\"id\":\"s43\",\"sender\":\"hello@orbitstudio.example\",\"name\":\"Orbitstudio Club\",\"emails\":4,\"mb\":0,\"last\":\"2026-03\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"News from the club\",\"Monthly update\"]},{\"id\":\"s44\",\"sender\":\"hello@copperfoods.example\",\"name\":\"Copperfoods Club\",\"emails\":4,\"mb\":0,\"last\":\"2026-09\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"News from the club\",\"Monthly update\"]},{\"id\":\"s45\",\"sender\":\"hello@cedarmarket.example\",\"name\":\"Cedarmarket Club\",\"emails\":4,\"mb\":0,\"last\":\"2026-04\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"News from the club\",\"Monthly update\"]},{\"id\":\"s46\",\"sender\":\"no-reply@willowtickets.example\",\"name\":\"Willowtickets\",\"emails\":4,\"mb\":0,\"last\":\"2026-10\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Your booking confirmation\",\"Confirm your email address\"]},{\"id\":\"s47\",\"sender\":\"no-reply@meadowbooks.example\",\"name\":\"Meadowbooks\",\"emails\":4,\"mb\":0,\"last\":\"2026-05\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Confirm your email address\",\"Your booking confirmation\"]},{\"id\":\"s48\",\"sender\":\"no-reply@northpets.example\",\"name\":\"Northpets\",\"emails\":4,\"mb\":0,\"last\":\"2026-08\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Confirm your email address\",\"Your booking confirmation\"]},{\"id\":\"s49\",\"sender\":\"lena.mensah@mail.example\",\"name\":\"Lena Mensah\",\"emails\":4,\"mb\":0,\"last\":\"2025-07\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Hello!\",\"Re: next week\"]},{\"id\":\"s50\",\"sender\":\"ellis.oduya@mail.example\",\"name\":\"Ellis Oduya\",\"emails\":4,\"mb\":0,\"last\":\"2024-10\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Re: quick question\",\"Re: next week\"]},{\"id\":\"s51\",\"sender\":\"alex.oduya@mail.example\",\"name\":\"Alex Oduya\",\"emails\":4,\"mb\":0,\"last\":\"2026-05\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Following up\",\"Re: quick question\"]},{\"id\":\"s52\",\"sender\":\"kai.novak@mail.example\",\"name\":\"Kai Novak\",\"emails\":4,\"mb\":0,\"last\":\"2024-02\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Following up\",\"Re: quick question\"]},{\"id\":\"s53\",\"sender\":\"news@silverbooks.example\",\"name\":\"Silverbooks\",\"emails\":3,\"mb\":0.1,\"last\":\"2026-03\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":true,\"subjects\":[\"Welcome! Here is 10% off\",\"Members-only offer\"]},{\"id\":\"s54\",\"sender\":\"news@silvertravel.example\",\"name\":\"Silvertravel\",\"emails\":3,\"mb\":0.1,\"last\":\"2025-03\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":true,\"subjects\":[\"Welcome! Here is 10% off\",\"Our autumn picks\"]},{\"id\":\"s55\",\"sender\":\"news@tidalprint.example\",\"name\":\"Tidalprint\",\"emails\":3,\"mb\":0.1,\"last\":\"2026-11\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Members-only offer\",\"Welcome! Here is 10% off\"]},{\"id\":\"s56\",\"sender\":\"news@summitprint.example\",\"name\":\"Summitprint\",\"emails\":3,\"mb\":0.1,\"last\":\"2026-11\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Welcome! Here is 10% off\",\"Members-only offer\"]},{\"id\":\"s57\",\"sender\":\"news@tidalfitness.example\",\"name\":\"Tidalfitness\",\"emails\":3,\"mb\":0,\"last\":\"2026-08\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Members-only offer\",\"Our autumn picks\"]},{\"id\":\"s58\",\"sender\":\"news@quillevents.example\",\"name\":\"Quillevents\",\"emails\":3,\"mb\":0,\"last\":\"2026-09\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Welcome! Here is 10% off\",\"Members-only offer\"]},{\"id\":\"s59\",\"sender\":\"hello@quillprint.example\",\"name\":\"Quillprint Club\",\"emails\":3,\"mb\":0,\"last\":\"2026-02\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Monthly update\"]},{\"id\":\"s60\",\"sender\":\"hello@rivermarket.example\",\"name\":\"Rivermarket Club\",\"emails\":3,\"mb\":0,\"last\":\"2026-06\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"News from the club\",\"Monthly update\"]}]}"
}

Reply:

{"senders":[
{"id":"s1","kind":"newsletter","action":"unsubscribe","why":["high_volume","has_unsubscribe"]},
{"id":"s2","kind":"promotion","action":"unsubscribe","why":["note_drop","mostly_promotions","has_unsubscribe"]},
{"id":"s3","kind":"social","action":"unsubscribe","why":["high_volume","has_unsubscribe"]},
{"id":"s4","kind":"newsletter","action":"unsubscribe","why":["high_volume","has_unsubscribe"]},
{"id":"s5","kind":"promotion","action":"unsubscribe","why":["note_drop","mostly_promotions","has_unsubscribe"]},
{"id":"s6","kind":"bill_finance","action":"delete_old","why":["high_volume","transactional"]},
{"id":"s7","kind":"newsletter","action":"delete_all","why":["stopped","mostly_promotions"]},
{"id":"s8","kind":"newsletter","action":"keep","why":["note_keep"]},
{"id":"s9","kind":"receipt_order","action":"delete_old","why":["note_drop","transactional"]},
{"id":"s10","kind":"bill_finance","action":"delete_old","why":["large_storage","transactional"]},
{"id":"s11","kind":"personal","action":"keep","why":["personal_sender"]},
{"id":"s12","kind":"personal","action":"keep","why":["personal_sender"]},
{"id":"s13","kind":"personal","action":"keep","why":["personal_sender"]},
{"id":"s14","kind":"personal","action":"keep","why":["personal_sender"]},
{"id":"s15","kind":"newsletter","action":"delete_all","why":["stopped","has_unsubscribe"]},
{"id":"s16","kind":"account_alert","action":"keep","why":["transactional"]},
{"id":"s17","kind":"personal","action":"keep","why":["personal_sender"]},
{"id":"s18","kind":"personal","action":"keep","why":["personal_sender"]},
{"id":"s19","kind":"promotion","action":"unsubscribe","why":["mostly_promotions","has_unsubscribe"]},
{"id":"s20","kind":"newsletter","action":"delete_all","why":["stopped","has_unsubscribe"]},
{"id":"s21","kind":"newsletter","action":"delete_all","why":["stopped","has_unsubscribe"]},
{"id":"s22","kind":"personal","action":"keep","why":["personal_sender"]},
{"id":"s23","kind":"personal","action":"keep","why":["personal_sender"]},
{"id":"s24","kind":"personal","action":"keep","why":["personal_sender"]},
{"id":"s25","kind":"personal","action":"keep","why":["personal_sender"]},
{"id":"s26","kind":"promotion","action":"unsubscribe","why":["mostly_promotions","has_unsubscribe"]},
{"id":"s27","kind":"promotion","action":"delete_all","why":["stopped","mostly_promotions"]},
{"id":"s28","kind":"promotion","action":"delete_all","why":["stopped","mostly_promotions"]},
{"id":"s29","kind":"promotion","action":"delete_all","why":["stopped","mostly_promotions"]},
{"id":"s30","kind":"newsletter","action":"delete_all","why":["stopped","has_unsubscribe"]},
{"id":"s31","kind":"account_alert","action":"keep","why":["transactional"]},
{"id":"s32","kind":"account_alert","action":"keep","why":["transactional"]},
{"id":"s33","kind":"account_alert","action":"keep","why":["transactional"]},
{"id":"s34","kind":"personal","action":"keep","why":["personal_sender"]},
{"id":"s35","kind":"personal","action":"keep","why":["personal_sender"]},
{"id":"s36","kind":"personal","action":"keep","why":["personal_sender"]},
{"id":"s37","kind":"promotion","action":"delete_all","why":["stopped","mostly_promotions"]},
{"id":"s38","kind":"promotion","action":"unsubscribe","why":["mostly_promotions","has_unsubscribe"]},
{"id":"s39","kind":"promotion","action":"delete_all","why":["stopped","mostly_promotions"]},
{"id":"s40","kind":"promotion","action":"unsubscribe","why":["mostly_promotions","has_unsubscribe"]},
{"id":"s41","kind":"promotion","action":"delete_all","why":["stopped","mostly_promotions"]},
{"id":"s42","kind":"newsletter","action":"delete_all","why":["stopped","has_unsubscribe"]},
{"id":"s43","kind":"newsletter","action":"delete_all","why":["stopped","has_unsubscribe"]},
{"id":"s44","kind":"newsletter","action":"review","why":["has_unsubscribe","bulk_sender"]},
{"id":"s45","kind":"newsletter","action":"delete_all","why":["stopped","has_unsubscribe"]},
{"id":"s46","kind":"travel_booking","action":"keep","why":["transactional"]},
{"id":"s47","kind":"account_alert","action":"keep","why":["transactional"]},
{"id":"s48","kind":"account_alert","action":"keep","why":["transactional"]},
{"id":"s49","kind":"personal","action":"keep","why":["personal_sender"]},
{"id":"s50","kind":"personal","action":"keep","why":["personal_sender"]},
{"id":"s51","kind":"personal","action":"keep","why":["personal_sender"]},
{"id":"s52","kind":"personal","action":"keep","why":["personal_sender"]},
{"id":"s53","kind":"promotion","action":"delete_all","why":["stopped","mostly_promotions"]},
{"id":"s54","kind":"promotion","action":"delete_all","why":["stopped","mostly_promotions"]},
{"id":"s55","kind":"promotion","action":"unsubscribe","why":["mostly_promotions","has_unsubscribe"]},
{"id":"s56","kind":"promotion","action":"unsubscribe","why":["mostly_promotions","has_unsubscribe"]},
{"id":"s57","kind":"promotion","action":"unsubscribe","why":["mostly_promotions","has_unsubscribe"]},
{"id":"s58","kind":"promotion","action":"unsubscribe","why":["mostly_promotions","has_unsubscribe"]},
{"id":"s59","kind":"newsletter","action":"delete_all","why":["stopped","has_unsubscribe"]},
{"id":"s60","kind":"newsletter","action":"review","why":["has_unsubscribe","bulk_sender"]}
]}

Errors

HTTPWhat to do
401The token is missing, expired or a guest token on a run. Get a personal token on the token page.
402The balance is below what the run reserves. Top up at skillsafe.ai/account/billing.
400The body is not a JSON object of the fields above, or a required field is missing or empty.
429Wait and retry with the same Idempotency-Key.

Step 1 — a tiny client helper

One function that sends JSON and unwraps the {data, error} envelope.

BASE="https://api.skillsafe.ai/v1/app-api"
TOKEN="paste-your-token-here"   # from https://gmail-cleanup.skillsafe.ai/tokens.html
api() { # api METHOD PATH [JSON-BODY]
  curl -s -X "$1" "$BASE$2" -H "Content-Type: application/json" \
    ${TOKEN:+-H "Authorization: Bearer $TOKEN"} ${3:+--data "$3"}
}

Step 2 — a token

A guest token is enough for /me and /estimate. A run is metered, so it needs your personal token: sign in on the token page and copy it.

# a guest token (enough for /me and /estimate); a run needs your personal token from /tokens.html
TOKEN=$(curl -s -X POST "$BASE/guest" -H "Content-Type: application/json" -d '{"slug":"gmail-cleanup"}' | jq -r '.data.token')

Step 3 — who am I, and my balance

subject_type is guest or user; credits is the balance (1 credit = $0.0001).

api GET /me | jq '.data | {subject_type, credits}' 

Step 4 — price a run for free

/estimate charges nothing and starts no job. hold_credits is the amount reserved while a run is in flight, not the price; the run is charged what it uses.

# input.json: the run input object - {"task": "sort", "note": "Keep anything from the school and from my family. I never read the shop emails.", "facts": "{\"emails_counted\":1807,\"mb_counted\":58.3,\"senders_counted\":152,\"senders_sent\":60,\"range\":\"all mail\",\"senders\":[{\"id\":\"s1\",\"sender\":\"briefing@dailyledger.example\",\"name\":\"The Daily Ledger\",\"emails\":300,\"mb\":3.8,\"last\":\"2026-11\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":true,\"large_storage\":true,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Morning briefing\",\"The week in charts\"]},{\"id\":\"s2\",\"sender\":\"deals@brightmart.example\",\"name\":\"Brightmart\",\"emails\":260,\"mb\":6.8,\"last\":\"2026-11\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":true,\"large_storage\":true,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Weekend deals up to 40% off\",\"Café week: 20% off coffee makers\"]},{\"id\":\"s3\",\"sender\":\"notify@friendsnet.example\",\"name\":\"Friendsnet\",\"emails\":220,\"mb\":1.6,\"last\":\"2026-11\",\"gmail_category\":\"social\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":false,\"high_volume\":true,\"large_storage\":true,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"See what friends shared this week\",\"Someone mentioned you in a comment\"]},{\"id\":\"s4\",\"sender\":\"letters@figandfern.example\",\"name\":\"Fig & Fern\",\"emails\":150,\"mb\":2.2,\"last\":\"2026-11\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":true,\"large_storage\":true,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"The Weekly Fig: compost, honestly\",\"The Weekly Fig: seed swaps\"]},{\"id\":\"s5\",\"sender\":\"hello@lumenoutfitters.example\",\"name\":\"Lumen Outfitters\",\"emails\":140,\"mb\":2.9,\"last\":\"2026-11\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":false,\"high_volume\":true,\"large_storage\":true,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Last call: winter coats\",\"Picked for you\"]},{\"id\":\"s6\",\"sender\":\"alerts@northbank.example\",\"name\":\"North Bank Alerts\",\"emails\":90,\"mb\":0.4,\"last\":\"2026-11\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":true,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Card payment over your alert amount\",\"Your balance alert\"]},{\"id\":\"s7\",\"sender\":\"news@trailheadjournal.example\",\"name\":\"Trailhead Journal\",\"emails\":80,\"mb\":1.3,\"last\":\"2025-09\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":true,\"large_storage\":true,\"mostly_promotions\":true,\"stopped\":true,\"subjects\":[\"Our last issue of the season\",\"New trails this month\"]},{\"id\":\"s8\",\"sender\":\"office@oakridge-school.example\",\"name\":\"Oakridge School Office\",\"emails\":70,\"mb\":16.4,\"last\":\"2026-11\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":false,\"high_volume\":true,\"large_storage\":true,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Weekly school newsletter\",\"Trip permission slip\"]},{\"id\":\"s9\",\"sender\":\"orders@shopnest.example\",\"name\":\"ShopNest Orders\",\"emails\":45,\"mb\":0.7,\"last\":\"2026-11\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":true,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Your order has shipped\",\"Your return has been received\"]},{\"id\":\"s10\",\"sender\":\"statements@northbank.example\",\"name\":\"North Bank\",\"emails\":36,\"mb\":6.6,\"last\":\"2026-11\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":true,\"large_storage\":true,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Your monthly statement is ready\"]},{\"id\":\"s11\",\"sender\":\"sam.rivera@mail.example\",\"name\":\"Sam Rivera\",\"emails\":25,\"mb\":0.1,\"last\":\"2026-11\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":true,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Re: moving help\",\"Concert tickets\"]},{\"id\":\"s12\",\"sender\":\"rosa.delgado@mail.example\",\"name\":\"Rosa Delgado\",\"emails\":22,\"mb\":12.2,\"last\":\"2026-11\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":true,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Re: lunch next week\",\"Pictures from the garden\"]},{\"id\":\"s13\",\"sender\":\"ravi.castell@mail.example\",\"name\":\"Ravi Castell\",\"emails\":8,\"mb\":0,\"last\":\"2025-03\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Re: next week\",\"Hello!\"]},{\"id\":\"s14\",\"sender\":\"tomas.castell@mail.example\",\"name\":\"Tomas Castell\",\"emails\":8,\"mb\":0,\"last\":\"2025-09\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Re: next week\",\"Hello!\"]},{\"id\":\"s15\",\"sender\":\"hello@copperfitness.example\",\"name\":\"Copperfitness Club\",\"emails\":7,\"mb\":0.1,\"last\":\"2026-03\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"News from the club\",\"Monthly update\"]},{\"id\":\"s16\",\"sender\":\"no-reply@quillfitness.example\",\"name\":\"Quillfitness\",\"emails\":7,\"mb\":0,\"last\":\"2026-03\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Confirm your email address\",\"Your password was changed\"]},{\"id\":\"s17\",\"sender\":\"lena.castell@mail.example\",\"name\":\"Lena Castell\",\"emails\":7,\"mb\":0,\"last\":\"2026-08\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Following up\",\"Hello!\"]},{\"id\":\"s18\",\"sender\":\"mina.castell@mail.example\",\"name\":\"Mina Castell\",\"emails\":7,\"mb\":0,\"last\":\"2025-10\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Re: next week\",\"Hello!\"]},{\"id\":\"s19\",\"sender\":\"news@quillfoods.example\",\"name\":\"Quillfoods\",\"emails\":6,\"mb\":0.1,\"last\":\"2026-09\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Members-only offer\",\"Welcome! Here is 10% off\"]},{\"id\":\"s20\",\"sender\":\"hello@harborevents.example\",\"name\":\"Harborevents Club\",\"emails\":6,\"mb\":0.1,\"last\":\"2025-11\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"News from the club\",\"Monthly update\"]},{\"id\":\"s21\",\"sender\":\"hello@northmarket.example\",\"name\":\"Northmarket Club\",\"emails\":6,\"mb\":0.1,\"last\":\"2025-08\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Monthly update\",\"News from the club\"]},{\"id\":\"s22\",\"sender\":\"kai.oduya@mail.example\",\"name\":\"Kai Oduya\",\"emails\":6,\"mb\":0,\"last\":\"2024-03\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Re: next week\",\"Re: quick question\"]},{\"id\":\"s23\",\"sender\":\"lena.ibarra@mail.example\",\"name\":\"Lena Ibarra\",\"emails\":6,\"mb\":0,\"last\":\"2026-04\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Re: quick question\",\"Hello!\"]},{\"id\":\"s24\",\"sender\":\"priya.brannigan@mail.example\",\"name\":\"Priya Brannigan\",\"emails\":6,\"mb\":0,\"last\":\"2025-12\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Re: next week\",\"Following up\"]},{\"id\":\"s25\",\"sender\":\"tomas.mensah@mail.example\",\"name\":\"Tomas Mensah\",\"emails\":6,\"mb\":0,\"last\":\"2025-01\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Hello!\",\"Following up\"]},{\"id\":\"s26\",\"sender\":\"news@harborbooks.example\",\"name\":\"Harborbooks\",\"emails\":5,\"mb\":0.1,\"last\":\"2026-08\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Our autumn picks\",\"Members-only offer\"]},{\"id\":\"s27\",\"sender\":\"news@quilltickets.example\",\"name\":\"Quilltickets\",\"emails\":5,\"mb\":0.1,\"last\":\"2025-07\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":true,\"subjects\":[\"Our autumn picks\",\"Members-only offer\"]},{\"id\":\"s28\",\"sender\":\"news@orbitfoods.example\",\"name\":\"Orbitfoods\",\"emails\":5,\"mb\":0.1,\"last\":\"2025-02\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":true,\"subjects\":[\"Members-only offer\",\"Our autumn picks\"]},{\"id\":\"s29\",\"sender\":\"news@silvermarket.example\",\"name\":\"Silvermarket\",\"emails\":5,\"mb\":0.1,\"last\":\"2026-05\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":true,\"subjects\":[\"Our autumn picks\",\"Members-only offer\"]},{\"id\":\"s30\",\"sender\":\"hello@pinefitness.example\",\"name\":\"Pinefitness Club\",\"emails\":5,\"mb\":0.1,\"last\":\"2024-03\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"News from the club\",\"Monthly update\"]},{\"id\":\"s31\",\"sender\":\"no-reply@summitfoods.example\",\"name\":\"Summitfoods\",\"emails\":5,\"mb\":0,\"last\":\"2026-09\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Your booking confirmation\",\"Confirm your email address\"]},{\"id\":\"s32\",\"sender\":\"no-reply@quillbooks.example\",\"name\":\"Quillbooks\",\"emails\":5,\"mb\":0,\"last\":\"2026-06\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Your password was changed\",\"Your booking confirmation\"]},{\"id\":\"s33\",\"sender\":\"no-reply@northmarket.example\",\"name\":\"Northmarket\",\"emails\":5,\"mb\":0,\"last\":\"2026-11\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Confirm your email address\",\"Your booking confirmation\"]},{\"id\":\"s34\",\"sender\":\"kai.sato@mail.example\",\"name\":\"Kai Sato\",\"emails\":5,\"mb\":0,\"last\":\"2025-02\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Hello!\",\"Following up\"]},{\"id\":\"s35\",\"sender\":\"owen.sato@mail.example\",\"name\":\"Owen Sato\",\"emails\":5,\"mb\":0,\"last\":\"2024-07\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Re: next week\",\"Re: quick question\"]},{\"id\":\"s36\",\"sender\":\"kai.castell@mail.example\",\"name\":\"Kai Castell\",\"emails\":5,\"mb\":0,\"last\":\"2026-09\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Following up\",\"Hello!\"]},{\"id\":\"s37\",\"sender\":\"news@lanternpets.example\",\"name\":\"Lanternpets\",\"emails\":4,\"mb\":0.1,\"last\":\"2025-07\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":true,\"subjects\":[\"Welcome! Here is 10% off\",\"Members-only offer\"]},{\"id\":\"s38\",\"sender\":\"news@pineprint.example\",\"name\":\"Pineprint\",\"emails\":4,\"mb\":0.1,\"last\":\"2026-10\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Welcome! Here is 10% off\"]},{\"id\":\"s39\",\"sender\":\"news@quillprint.example\",\"name\":\"Quillprint\",\"emails\":4,\"mb\":0.1,\"last\":\"2025-09\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":true,\"subjects\":[\"Welcome! Here is 10% off\",\"Our autumn picks\"]},{\"id\":\"s40\",\"sender\":\"news@ambergames.example\",\"name\":\"Ambergames\",\"emails\":4,\"mb\":0.1,\"last\":\"2026-08\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Our autumn picks\",\"Members-only offer\"]},{\"id\":\"s41\",\"sender\":\"news@summittravel.example\",\"name\":\"Summittravel\",\"emails\":4,\"mb\":0.1,\"last\":\"2026-04\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":true,\"subjects\":[\"Our autumn picks\",\"Welcome! Here is 10% off\"]},{\"id\":\"s42\",\"sender\":\"hello@meadowbooks.example\",\"name\":\"Meadowbooks Club\",\"emails\":4,\"mb\":0.1,\"last\":\"2024-10\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Monthly update\",\"News from the club\"]},{\"id\":\"s43\",\"sender\":\"hello@orbitstudio.example\",\"name\":\"Orbitstudio Club\",\"emails\":4,\"mb\":0,\"last\":\"2026-03\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"News from the club\",\"Monthly update\"]},{\"id\":\"s44\",\"sender\":\"hello@copperfoods.example\",\"name\":\"Copperfoods Club\",\"emails\":4,\"mb\":0,\"last\":\"2026-09\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"News from the club\",\"Monthly update\"]},{\"id\":\"s45\",\"sender\":\"hello@cedarmarket.example\",\"name\":\"Cedarmarket Club\",\"emails\":4,\"mb\":0,\"last\":\"2026-04\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"News from the club\",\"Monthly update\"]},{\"id\":\"s46\",\"sender\":\"no-reply@willowtickets.example\",\"name\":\"Willowtickets\",\"emails\":4,\"mb\":0,\"last\":\"2026-10\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Your booking confirmation\",\"Confirm your email address\"]},{\"id\":\"s47\",\"sender\":\"no-reply@meadowbooks.example\",\"name\":\"Meadowbooks\",\"emails\":4,\"mb\":0,\"last\":\"2026-05\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Confirm your email address\",\"Your booking confirmation\"]},{\"id\":\"s48\",\"sender\":\"no-reply@northpets.example\",\"name\":\"Northpets\",\"emails\":4,\"mb\":0,\"last\":\"2026-08\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"Confirm your email address\",\"Your booking confirmation\"]},{\"id\":\"s49\",\"sender\":\"lena.mensah@mail.example\",\"name\":\"Lena Mensah\",\"emails\":4,\"mb\":0,\"last\":\"2025-07\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Hello!\",\"Re: next week\"]},{\"id\":\"s50\",\"sender\":\"ellis.oduya@mail.example\",\"name\":\"Ellis Oduya\",\"emails\":4,\"mb\":0,\"last\":\"2024-10\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Re: quick question\",\"Re: next week\"]},{\"id\":\"s51\",\"sender\":\"alex.oduya@mail.example\",\"name\":\"Alex Oduya\",\"emails\":4,\"mb\":0,\"last\":\"2026-05\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Following up\",\"Re: quick question\"]},{\"id\":\"s52\",\"sender\":\"kai.novak@mail.example\",\"name\":\"Kai Novak\",\"emails\":4,\"mb\":0,\"last\":\"2024-02\",\"gmail_category\":\"none\",\"category_share\":0,\"has_unsubscribe\":false,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Following up\",\"Re: quick question\"]},{\"id\":\"s53\",\"sender\":\"news@silverbooks.example\",\"name\":\"Silverbooks\",\"emails\":3,\"mb\":0.1,\"last\":\"2026-03\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":true,\"subjects\":[\"Welcome! Here is 10% off\",\"Members-only offer\"]},{\"id\":\"s54\",\"sender\":\"news@silvertravel.example\",\"name\":\"Silvertravel\",\"emails\":3,\"mb\":0.1,\"last\":\"2025-03\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":true,\"subjects\":[\"Welcome! Here is 10% off\",\"Our autumn picks\"]},{\"id\":\"s55\",\"sender\":\"news@tidalprint.example\",\"name\":\"Tidalprint\",\"emails\":3,\"mb\":0.1,\"last\":\"2026-11\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Members-only offer\",\"Welcome! Here is 10% off\"]},{\"id\":\"s56\",\"sender\":\"news@summitprint.example\",\"name\":\"Summitprint\",\"emails\":3,\"mb\":0.1,\"last\":\"2026-11\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Welcome! Here is 10% off\",\"Members-only offer\"]},{\"id\":\"s57\",\"sender\":\"news@tidalfitness.example\",\"name\":\"Tidalfitness\",\"emails\":3,\"mb\":0,\"last\":\"2026-08\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":false,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Members-only offer\",\"Our autumn picks\"]},{\"id\":\"s58\",\"sender\":\"news@quillevents.example\",\"name\":\"Quillevents\",\"emails\":3,\"mb\":0,\"last\":\"2026-09\",\"gmail_category\":\"promotions\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":true,\"stopped\":false,\"subjects\":[\"Welcome! Here is 10% off\",\"Members-only offer\"]},{\"id\":\"s59\",\"sender\":\"hello@quillprint.example\",\"name\":\"Quillprint Club\",\"emails\":3,\"mb\":0,\"last\":\"2026-02\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":true,\"subjects\":[\"Monthly update\"]},{\"id\":\"s60\",\"sender\":\"hello@rivermarket.example\",\"name\":\"Rivermarket Club\",\"emails\":3,\"mb\":0,\"last\":\"2026-06\",\"gmail_category\":\"updates\",\"category_share\":100,\"has_unsubscribe\":true,\"one_click\":true,\"high_volume\":false,\"large_storage\":false,\"mostly_promotions\":false,\"stopped\":false,\"subjects\":[\"News from the club\",\"Monthly update\"]}]}"}
api POST /estimate "$(cat input.json)" | jq '.data | {hold_credits, min_credits, model, model_alias, markup_bps, warnings}' 

Step 5 — run it and wait for the job

Send an Idempotency-Key derived from the input: a retry with the same key is never billed twice.

KEY="gmail-cleanup:sort:$(shasum -a 256 input.json | cut -c1-16):a1"
JOB=$(curl -s -X POST "$BASE/run" -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" \
  -H "Idempotency-Key: $KEY" --data @input.json | jq -r '.data.job_id')
while :; do
  J=$(api GET "/jobs/$JOB"); S=$(echo "$J" | jq -r '.data.status')
  case "$S" in succeeded|failed|cancelled) break;; esac; sleep 2
done
echo "$J" | jq -r '.data.output.output' > reply.json   # one JSON object: senders [{id, kind, action, why}]
echo "$J" | jq '.data | {charged_credits, truncated}' 

Step 6 — or stream it

/run-stream sends Server-Sent Events while the job runs and the finished job at the end.

# Server-Sent Events: tick/delta events while the job runs, then a final event with the job
curl -N -s -X POST "$BASE/run-stream" -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" \
  -H "Idempotency-Key: gmail-cleanup:sort:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json