{"_id":"@mailsai/sdk","_rev":"15-3d8df212a122bff872b4f41686929a4b","name":"@mailsai/sdk","dist-tags":{"latest":"0.5.2"},"versions":{"0.1.0":{"name":"@mailsai/sdk","version":"0.1.0","keywords":["email","ai","agent","mcp","mails.ai","agent-identity","sender-reputation","agent-email","prompt-injection","smtp","transactional-email"],"license":"MIT","_id":"@mailsai/sdk@0.1.0","maintainers":[{"name":"mailsai","email":"richard@mails.ai"}],"homepage":"https://mails.ai","bugs":{"url":"https://github.com/RolloutsAI/mails-api/issues"},"dist":{"shasum":"77d693e7902a3d82a09c8bd1b8dc243cb259b4b6","tarball":"https://registry.npmjs.org/@mailsai/sdk/-/sdk-0.1.0.tgz","fileCount":6,"integrity":"sha512-k5VmHM78+CLkT38v/KU9bb61FMOpnuMV9AjDgObB44P5WQXNfd3Co9f4y1olZD+aDKAamh2ZC1ugpOtQcMR+Vg==","signatures":[{"sig":"MEYCIQDa15f7Y04fGzwlMAtcFM17wJvP9lJBPm+6tktGBVt3UgIhAKwiNiSDqmZ6xUU2PgtV657K6Izrv4RIZPTdRgzzLCf4","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":66223},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"9a28c57fdcbdd17b135d26bda5e25dc476b0c4c3","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"mailsai","email":"richard@mails.ai"},"repository":{"url":"git+https://github.com/RolloutsAI/mails-api.git","type":"git","directory":"packages/sdk"},"_npmVersion":"10.9.4","description":"Email API for AI agents — TypeScript SDK. Per-agent email addresses on your domain, per-agent reputation, and prompt-injection scanning on every inbound. Send, receive structured inbound replies, and identify agents via REST. Intent + entity extraction is","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^20"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.0_1784538375786_0.049177256956789206","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@mailsai/sdk","version":"0.1.1","keywords":["email","ai","agent","mcp","mails.ai","agent-identity","sender-reputation","agent-email","prompt-injection","smtp","transactional-email"],"license":"MIT","_id":"@mailsai/sdk@0.1.1","maintainers":[{"name":"mailsai","email":"richard@mails.ai"}],"homepage":"https://mails.ai","bugs":{"url":"https://github.com/RolloutsAI/mails-api/issues"},"dist":{"shasum":"4e739871e1a4d37ee322a44dd35bb9d507ff7a21","tarball":"https://registry.npmjs.org/@mailsai/sdk/-/sdk-0.1.1.tgz","fileCount":6,"integrity":"sha512-YZQ9Q2w4sB3QxmB3EG1drCIaR8dvSm7j3MaKtPrzZlgYnn5Eky2d4xPJeoBb3gNnIdEVa407qe4PtOq01vWjVQ==","signatures":[{"sig":"MEUCIFyAwka1ngfmQimrXok2t3wcgMrARBpfR6JYZOIfAC18AiEAt1OLTEg3GZS9RV0RddBbKYOtYSck4VVR8ce1dupQ1jo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":67152},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"99107ccc424a9403c7fb6fd1b7dd9f10118e82d5","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"mailsai","email":"richard@mails.ai"},"repository":{"url":"git+https://github.com/RolloutsAI/mails-api.git","type":"git","directory":"packages/sdk"},"_npmVersion":"11.11.0","description":"Email API for AI agents — TypeScript SDK. Per-agent email addresses on your domain, per-agent reputation, and prompt-injection scanning on every inbound. Send, receive structured inbound replies, and identify agents via REST. Intent + entity extraction is","directories":{},"_nodeVersion":"25.8.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^20"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.1_1785243808168_0.5107557536795833","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@mailsai/sdk","version":"0.2.0","keywords":["email","ai","agent","mcp","mails.ai","agent-identity","sender-reputation","agent-email","prompt-injection","smtp","transactional-email"],"license":"MIT","_id":"@mailsai/sdk@0.2.0","maintainers":[{"name":"mailsai","email":"richard@mails.ai"}],"homepage":"https://mails.ai","bugs":{"url":"https://github.com/RolloutsAI/mailsai/issues"},"dist":{"shasum":"10d89ddfddb5f52bc829a55d572c663221d5c88b","tarball":"https://registry.npmjs.org/@mailsai/sdk/-/sdk-0.2.0.tgz","fileCount":6,"integrity":"sha512-w3YyF7QjyKnx9AgNaPxHIGHNpNfF1bLJbbOx4YXc3o9/Ah8GgSd/hQu2KfdPcLNu9T6eyWYVNR+V9X4SQduYGQ==","signatures":[{"sig":"MEQCIENBdT8qnIptzxgJ8dslZdLP3N7kzbFx+utOdOt/+lcOAiBKB/lpBmqCC4hwcEtpNw5G2ZkcYvWTLc6mdWM/qeWnfA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":71807},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"a853cb6d5cf4924c56b9d922516b50bb52a3b6d1","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"mailsai","email":"richard@mails.ai"},"repository":{"url":"git+https://github.com/RolloutsAI/mailsai.git","type":"git","directory":"packages/sdk"},"_npmVersion":"10.9.4","description":"Email API for AI agents — TypeScript SDK. Per-agent email addresses on your domain, per-agent reputation, and prompt-injection scanning on every inbound. Send, receive structured inbound replies, and identify agents via REST. Intent + entity extraction is","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^20"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.0_1786346719748_0.9178292574361793","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@mailsai/sdk","version":"0.2.1","keywords":["email","ai","agent","mcp","mails.ai","agent-identity","sender-reputation","agent-email","prompt-injection","smtp","transactional-email"],"license":"MIT","_id":"@mailsai/sdk@0.2.1","maintainers":[{"name":"mailsai","email":"richard@mails.ai"}],"homepage":"https://mails.ai","bugs":{"url":"https://github.com/RolloutsAI/mailsai/issues"},"dist":{"shasum":"7251f7f365b27a49c729d5700a7473fd6c606509","tarball":"https://registry.npmjs.org/@mailsai/sdk/-/sdk-0.2.1.tgz","fileCount":6,"integrity":"sha512-cM8UcL0vVzGm+nO+LctlyXuExwqst0chXpH1DKe1JrW7lQ713bpPKWpZcTSwsgPpRkCoUExjZLqs0zrH+fpJ1A==","signatures":[{"sig":"MEUCIQD7f7zBWLPKd9Mhb/a71NxqVYCvDKPQ+1+TbU3eePCMqAIgW11cKy2Arf8q15qXtoE76Jr2ToAgG8oh238x/uQ3qiM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":72184},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"d82b375b5abe6a080b8eff119136bcc869c3fd3e","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"mailsai","email":"richard@mails.ai"},"repository":{"url":"git+https://github.com/RolloutsAI/mailsai.git","type":"git","directory":"packages/sdk"},"_npmVersion":"10.9.4","description":"Email API for AI agents — TypeScript SDK. Per-agent email addresses on your domain, per-agent reputation, and prompt-injection scanning on every inbound. Send, receive structured inbound replies, and identify agents via REST. Intent + entity extraction is","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^20"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.1_1786420943676_0.026153725911799874","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@mailsai/sdk","version":"0.2.2","keywords":["email","ai","agent","mcp","mails.ai","agent-identity","sender-reputation","agent-email","prompt-injection","smtp","transactional-email"],"license":"MIT","_id":"@mailsai/sdk@0.2.2","maintainers":[{"name":"mailsai","email":"richard@mails.ai"}],"homepage":"https://mails.ai","bugs":{"url":"https://github.com/RolloutsAI/mailsai/issues"},"dist":{"shasum":"a17b463cee16d1acd548c08fab211cadef48feb4","tarball":"https://registry.npmjs.org/@mailsai/sdk/-/sdk-0.2.2.tgz","fileCount":6,"integrity":"sha512-A+0HsSa513w3yAzKRkaC279YpHDGOe5R2/A4Rhl/dpLw943zujkOESn/fuztPp1GYe/VMw611Asq2qcR7GfT2w==","signatures":[{"sig":"MEUCIQDiGBXP6ktIaYGtFrL4g4TsLzxKeaWXZELxKm3LenlWzgIgU37QCPG3HmY1NRJEHMdmKh6c81dxeyVOy156inpkuF8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":72692},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"d0c8a7fbe9190f61422cb08e9bf2e638744f9647","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"mailsai","email":"richard@mails.ai"},"repository":{"url":"git+https://github.com/RolloutsAI/mailsai.git","type":"git","directory":"packages/sdk"},"_npmVersion":"11.11.0","description":"Email API for AI agents — TypeScript SDK. Per-agent email addresses on your domain, per-agent reputation, and prompt-injection scanning on every inbound. Send, receive structured inbound replies, and identify agents via REST. Intent + entity extraction is","directories":{},"_nodeVersion":"25.8.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^20"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.2_1786690344517_0.3470849920472412","host":"s3://npm-registry-packages-npm-production"}},"0.2.3":{"name":"@mailsai/sdk","version":"0.2.3","keywords":["email","ai","agent","mcp","mails.ai","agent-identity","sender-reputation","agent-email","prompt-injection","smtp","transactional-email"],"license":"MIT","_id":"@mailsai/sdk@0.2.3","maintainers":[{"name":"mailsai","email":"richard@mails.ai"}],"homepage":"https://mails.ai","bugs":{"url":"https://github.com/RolloutsAI/mailsai/issues"},"dist":{"shasum":"a7f3cbc8f0e160db4bc849c0f6d1a364603d6002","tarball":"https://registry.npmjs.org/@mailsai/sdk/-/sdk-0.2.3.tgz","fileCount":6,"integrity":"sha512-x3u/Kkc58HPr0Cf7AEUckOrCy8MJ/pVkB5qh0+sX62pXjQWxSdKMmbfzPLKMQGaKDqaRYhViz5tjBX1/ERkPgQ==","signatures":[{"sig":"MEQCIFy1NWhkVueZpXwU5m56XXz9JCOLdQt404acD/VSeSdWAiAh2o6iPu+m5VeWfSHJ4lw+pUYR840pRgnsaponntwqZQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":73882},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"d30467f2a92b243cfe4800d634db2b805a8963e8","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"mailsai","email":"richard@mails.ai"},"repository":{"url":"git+https://github.com/RolloutsAI/mailsai.git","type":"git","directory":"packages/sdk"},"_npmVersion":"11.11.0","description":"Email API for AI agents — TypeScript SDK. Per-agent email addresses on your domain, per-agent reputation, and prompt-injection scanning on every inbound. Send, receive structured inbound replies, and identify agents via REST. Intent + entity extraction is","directories":{},"_nodeVersion":"25.8.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^20"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.3_1786690671659_0.6806704406146225","host":"s3://npm-registry-packages-npm-production"}},"0.2.4":{"name":"@mailsai/sdk","version":"0.2.4","keywords":["email","ai","agent","mcp","mails.ai","agent-identity","sender-reputation","agent-email","prompt-injection","smtp","transactional-email"],"license":"MIT","_id":"@mailsai/sdk@0.2.4","maintainers":[{"name":"mailsai","email":"richard@mails.ai"}],"homepage":"https://mails.ai","bugs":{"url":"https://mails.ai/contact"},"dist":{"shasum":"77c53c9edccd6c69fc89c77256d3c4506a04aa3a","tarball":"https://registry.npmjs.org/@mailsai/sdk/-/sdk-0.2.4.tgz","fileCount":6,"integrity":"sha512-z2mAlfjw/nYitYqRCBCcpZIypOKlaiDSuzWoomNm2Gw2xnnzIcVxQbPy7wRZT9zeBjzgr8VMxt0qJoI/XXxJJA==","signatures":[{"sig":"MEYCIQC34dtMQSf6AKQAvhSBTCi4o+uS/ARWANLzDncLoLcUWQIhALtXU2n91oHbkvo1rcdGNa/OigWs5QUV4XiVBThrZ4IW","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQDz/BQDF0Cki9SsQzXi7W6zGI2mIm0y6o3VFfigR9CfaAIgDp0s5g5M/zjN6NEWaLGz0K7OoDJGOn0ZQb2F2SchMgE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":73722},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"96d9b3209151df2a3a02270129a365a8c12d3d7a","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"mailsai","email":"richard@mails.ai"},"_npmVersion":"10.9.4","description":"Email API for AI agents — TypeScript SDK. Per-agent email addresses on your domain, per-agent reputation, and prompt-injection scanning on every inbound. Send, receive structured inbound replies, and identify agents via REST. Intent + entity extraction is","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^20"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.4_1788509418273_0.4548527704599188","host":"s3://npm-registry-packages-npm-production"}},"0.2.5":{"name":"@mailsai/sdk","version":"0.2.5","keywords":["email","ai","agent","mcp","mails.ai","agent-identity","sender-reputation","agent-email","prompt-injection","smtp","transactional-email"],"license":"MIT","_id":"@mailsai/sdk@0.2.5","maintainers":[{"name":"mailsai","email":"richard@mails.ai"}],"homepage":"https://mails.ai","bugs":{"url":"https://mails.ai/contact"},"dist":{"shasum":"4554a0b52e5e5c66dd971f718434537d17275fea","tarball":"https://registry.npmjs.org/@mailsai/sdk/-/sdk-0.2.5.tgz","fileCount":6,"integrity":"sha512-yNvlw0/LhjyJTspZc3yVS6htfewLJab7p/3CWzEjT7454te/fm3gR68FhRQ2kL3S2Omds2/hUcEswJ566J64sA==","signatures":[{"sig":"MEYCIQDNSFGwa0RrGrWLpd98vy83mCIG/eOJWlRjUONhjVf3PgIhALJZdnRrEhx7WGs8NkFfJFWqbGZBQHPTV0JzN+/R86/k","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIFYsTMuYYUmPUBo6GC3F3YawFZyCP1Rqlv79kpIVLGu3AiARhyMMod3h7PEokV4zvP1g78vkVlmS5YTk8cGKDIyL/Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":73716},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"b43ccd0c4cd6060591b69b3d9944ea4bba45e45b","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"mailsai","email":"richard@mails.ai"},"_npmVersion":"11.11.0","description":"Email API for AI agents — TypeScript SDK. Per-agent email addresses on your domain, per-agent reputation, and prompt-injection scanning on every inbound. Send, receive structured inbound replies, and identify agents via REST. Intent + entity extraction is","directories":{},"_nodeVersion":"25.8.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^20"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.5_1790967948717_0.319322554050528","host":"s3://npm-registry-packages-npm-production"}},"0.2.6":{"name":"@mailsai/sdk","version":"0.2.6","keywords":["email","ai","agent","mcp","mails.ai","agent-identity","sender-reputation","agent-email","prompt-injection","smtp","transactional-email"],"license":"MIT","_id":"@mailsai/sdk@0.2.6","maintainers":[{"name":"mailsai","email":"dev@mails.ai"}],"homepage":"https://mails.ai","bugs":{"url":"https://mails.ai/contact"},"dist":{"shasum":"f4ab0e5ea0434a103ef9107d98de0d3f0f7657b6","tarball":"https://registry.npmjs.org/@mailsai/sdk/-/sdk-0.2.6.tgz","fileCount":6,"integrity":"sha512-kWEf7h+fQlPkzRnBIhKLDnPpAv+FybX22Z8FR8INVYAIVgcEqQ/TgyR0WMY6aG6W1Fh0/m0/dhs11nKgJXIIRg==","signatures":[{"sig":"MEYCIQCW2WyQWSIH0wsj5ak781cQoLI3EXAHQ7ier0e7ucu8ggIhAL0diMbgP0+4Wmu1LiEKES77AN+Cr5QQE2/xso59mr+N","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIHLO1CTzmqSCGmCvkoRwjHFx0dtpLM8Hl20iO5uft21/AiEAndMmd0X6jddAjnbdQuaA4n4XLaMTJ4CmwGrp2ccek3g=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":73716},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"mailsai","email":"dev@mails.ai"},"_npmVersion":"11.11.0","description":"Email API for AI agents — TypeScript SDK. Per-agent email addresses on your domain, per-agent reputation, and prompt-injection scanning on every inbound. Send, receive structured inbound replies, and identify agents via REST. Intent + entity extraction is","directories":{},"_nodeVersion":"25.8.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^20"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.6_1791033376484_0.08879995744580071","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@mailsai/sdk","version":"0.3.0","keywords":["email","ai","agent","mcp","mails.ai","agent-identity","sender-reputation","agent-email","prompt-injection","smtp","transactional-email"],"license":"MIT","_id":"@mailsai/sdk@0.3.0","maintainers":[{"name":"mailsai","email":"dev@mails.ai"}],"homepage":"https://mails.ai","bugs":{"url":"https://mails.ai/contact"},"dist":{"shasum":"0ee0150cec22103a76d0d276227ee7fe91ec87ad","tarball":"https://registry.npmjs.org/@mailsai/sdk/-/sdk-0.3.0.tgz","fileCount":6,"integrity":"sha512-syCQxVQBp92n7UBV6/OG/Iaewr0gUTS7QDVO+BptHxcwcU9sASOKHpP39bXtYg+eQOnt+5Zs5M1YGzYyfUeM9Q==","signatures":[{"sig":"MEUCIDHw9Nl3mTfKjQ77P0844y8IbkP/qtJoO+qZsLJ9XOGGAiEAupm8r+OsDYd03HOsUcAqrj6ZZnKwXvpvq18SgSbq8pw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIAJnXhAaITLPqvkoiWM0F5kOfhpBPckLntFtWsJaNuobAiAhpodpkkiD5DvKnfIA24nF0D+KqUa7PsjXLYtwqygdkw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":177828},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"7ba8742ad549c7a338870033bed39a3b5327a649","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"mailsai","email":"dev@mails.ai"},"_npmVersion":"11.21.0","description":"Email API for AI agents — TypeScript SDK. Per-agent email addresses on your domain, per-agent reputation, and prompt-injection scanning on inbound mail. Send, receive structured inbound replies, and identify agents via REST. Intent + entity extraction is ","directories":{},"_nodeVersion":"22.23.3","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^20"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.3.0_1791651204511_0.9125822006256159","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"name":"@mailsai/sdk","version":"0.3.1","keywords":["email","ai","agent","mcp","mails.ai","agent-identity","sender-reputation","agent-email","prompt-injection","smtp","transactional-email"],"license":"MIT","_id":"@mailsai/sdk@0.3.1","maintainers":[{"name":"mailsai","email":"dev@mails.ai"}],"homepage":"https://mails.ai","bugs":{"url":"https://mails.ai/contact"},"dist":{"shasum":"e83cf852945fdafbfac3ab0c1d844855ae1e7097","tarball":"https://registry.npmjs.org/@mailsai/sdk/-/sdk-0.3.1.tgz","fileCount":6,"integrity":"sha512-6dLKHdQB4HZoSI1RF5+lhswGIlwlR/XJ9jzhBmyWDTuLSiZ4TUjVDn4syvLD9pavzk5g+RERuRM4aeBL352Mmg==","signatures":[{"sig":"MEUCIGq60UcRAaWjg6ok1ahjRTdFBcbHqSBcd4YKzASNV8WdAiEAp2epq9vy7bwEwdgbi2zPx3xMCDDYrDGvyV8S3JiNsuU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIA2Svw09VDGiysP1TdlOMTRJVAISrUDKJTnZZCsF4A6hAiB0u7BrWb8WVKDOyeFMYoL5H2btl88STJkm2vrr6irKfg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":178412},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"mailsai","email":"dev@mails.ai"},"_npmVersion":"10.9.4","description":"Email API for AI agents — TypeScript SDK. Per-agent email addresses on your domain, per-agent reputation, and prompt-injection scanning on inbound mail. Send, receive structured inbound replies, and identify agents via REST. Intent + entity extraction is ","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^20"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.3.1_1791692048304_0.23436816730458854","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@mailsai/sdk","version":"0.4.0","keywords":["email","ai","agent","mcp","mails.ai","agent-identity","sender-reputation","agent-email","prompt-injection","smtp","transactional-email"],"license":"MIT","_id":"@mailsai/sdk@0.4.0","maintainers":[{"name":"mailsai","email":"dev@mails.ai"}],"homepage":"https://mails.ai","bugs":{"url":"https://mails.ai/contact"},"dist":{"shasum":"f0fa6830df23fbb586ffdc8369c8592b6040cdbf","tarball":"https://registry.npmjs.org/@mailsai/sdk/-/sdk-0.4.0.tgz","fileCount":6,"integrity":"sha512-vD4XoroMLXj+DZyy1GlqSqKOUpD4u55sMPKjK2wCD3a3V5mLoonzR47lb8AYqAQeF0LZuDgMLdpPuFKu81i+DQ==","signatures":[{"sig":"MEQCIEzxEuKMaxfCGVhrVVBX7VIUHxsrF1yavLk6+yf0Fo1HAiBEsU1kR4GoYu2q+qYAGScYXgQ0rTGVuXdFDLeJF1A5Rg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQC6uilrby9ccFDneNqk1vIHz07DlegCuxxard6Ew07VjAIge2eIl8bJstKDVPhimAyO7RKpKdcswq0YXHl5gM+ZZaA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":182787},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"mailsai","email":"dev@mails.ai"},"_npmVersion":"10.9.4","description":"Email API for AI agents — TypeScript SDK. Per-agent email addresses on your domain, per-agent reputation, and prompt-injection scanning on inbound mail. Send, receive structured inbound replies, and identify agents via REST. Intent + entity extraction is ","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^20"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.4.0_1791808102553_0.26895912501315733","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@mailsai/sdk","version":"0.5.0","keywords":["email","ai","agent","mcp","mails.ai","agent-identity","sender-reputation","agent-email","prompt-injection","smtp","transactional-email"],"license":"MIT","_id":"@mailsai/sdk@0.5.0","maintainers":[{"name":"mailsai","email":"dev@mails.ai"}],"homepage":"https://mails.ai","bugs":{"url":"https://mails.ai/contact"},"dist":{"shasum":"a21858f4a002e58b089274aa3f554eb571f18025","tarball":"https://registry.npmjs.org/@mailsai/sdk/-/sdk-0.5.0.tgz","fileCount":6,"integrity":"sha512-osKZRawOIjk6YSPyUy3N5BIunMzRGa6ZKw2Vudi5eSK6a/v/80IWvSg+Dn+AX2p+GeoifPMrCpNmxhP5Rl5ZOw==","signatures":[{"sig":"MEQCIEx4GtSdEZoTUxWVA5sqDjTN7kgU0ry4pwceml6cCTcpAiAhnVUCTFBSjEp/Q8kClVsa+qPaQvKAFygb/9Cpih8QiA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQDWrc9AVf5nwFE2la+b2wRn2JE2e8soQUXdyewUbf9iMwIgbtOJxT+J6LofpvOqMlaB/1SGUtNTEzsimcV0BWt9//Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":189266},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"mailsai","email":"dev@mails.ai"},"_npmVersion":"10.9.4","description":"Email API for AI agents — TypeScript SDK. Per-agent email addresses on your domain, per-agent reputation, and prompt-injection scanning on inbound mail. Send, receive structured inbound replies, and identify agents via REST. Intent + entity extraction is ","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^20"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.5.0_1792166083762_0.18168570272201068","host":"s3://npm-registry-packages-npm-production"}},"0.5.1":{"name":"@mailsai/sdk","version":"0.5.1","keywords":["email","ai","agent","mcp","mails.ai","agent-identity","sender-reputation","agent-email","prompt-injection","smtp","transactional-email"],"license":"MIT","_id":"@mailsai/sdk@0.5.1","maintainers":[{"name":"mailsai","email":"dev@mails.ai"}],"homepage":"https://mails.ai","bugs":{"url":"https://mails.ai/contact"},"dist":{"shasum":"dc294cb9bfb45f6d0ad89dc72f0fb8d084a7e3e3","tarball":"https://registry.npmjs.org/@mailsai/sdk/-/sdk-0.5.1.tgz","fileCount":6,"integrity":"sha512-edl2TX0Kx2YdiRb+afsnB7Uh+dXpCpc5/i/3tYApBuX4EBcSS00BPQYx0tToreTOUvORjHc4KW31OxBfnS/lHw==","signatures":[{"sig":"MEUCIE0NCa/Uy7ien3wpERPaKnZbwGRS1fRk9W/0NTg2Lo/iAiEAgTq+8sCCPaW4VCoxC+V9O+ENZ0rqYRdy8gT59fHpXgc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIDX43Z3y5k4xPHYeJUpwdVq4yIcvebAGKWMu1IhSMDbKAiB/pv00Thg7/wFzgTH1/tRccsRxH/Ghe6ccHi0KsUPr+A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":189611},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"mailsai","email":"dev@mails.ai"},"_npmVersion":"10.9.4","description":"Email API for AI agents — TypeScript SDK. Per-agent email addresses on your domain, per-agent reputation, and prompt-injection scanning on inbound mail. Send, receive structured inbound replies, and identify agents via REST. Intent + entity extraction is ","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^20"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.5.1_1792170062739_0.9243712792826906","host":"s3://npm-registry-packages-npm-production"}},"0.5.2":{"_id":"@mailsai/sdk@0.5.2","bugs":{"url":"https://mails.ai/contact"},"dist":{"shasum":"3902e5c6213ed6b383da42fe4f8f5ab832d3901c","tarball":"https://registry.npmjs.org/@mailsai/sdk/-/sdk-0.5.2.tgz","fileCount":6,"integrity":"sha512-sQSjmi366n0ZXlqOk0Z+oWW9z3Cfe3AoUly4uGIG3DsBXUQP8aSNhlRMcYlv8/fyuc0HyIg8GyKJTH6DU91JuQ==","signatures":[{"sig":"MEQCICgF9sTUgslGggfKtOiNNnA5JbtwPoIHJty5als2KTytAiBCHNlZ0LVumjVFRTmCt92ogKYcu2/t6z6WEW9n/hvktQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDKp15JjJxHRIssWSYIXDPFZNalNSf57fzBBWngxjlmJwIgU4FIIL5XWPJmTGC8zquz8RUeKnnOjjmffy5vg0H6ZjQ="}],"unpackedSize":189770},"main":"./dist/index.js","name":"@mailsai/sdk","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"license":"MIT","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"version":"0.5.2","_npmUser":{"name":"mailsai","email":"dev@mails.ai"},"homepage":"https://mails.ai","keywords":["email","ai","agent","mcp","mails.ai","agent-identity","sender-reputation","agent-email","prompt-injection","smtp","transactional-email"],"_npmVersion":"10.9.4","description":"Email API for AI agents — TypeScript SDK. Per-agent email addresses on your domain, per-agent reputation, and prompt-injection scanning on inbound mail. Send, receive structured inbound replies, and identify agents via REST. Intent + entity extraction is ","directories":{},"maintainers":[{"name":"mailsai","email":"dev@mails.ai"}],"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^20"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.5.2_1792438798328_0.7632989194814557"}}},"time":{"created":"2026-07-20T09:06:15.592Z","modified":"2026-10-19T19:39:58.806Z","0.1.0":"2026-07-20T09:06:15.924Z","0.1.1":"2026-07-28T13:03:28.317Z","0.2.0":"2026-08-10T07:25:19.892Z","0.2.1":"2026-08-11T04:02:23.903Z","0.2.2":"2026-08-14T06:52:24.670Z","0.2.3":"2026-08-14T06:57:51.797Z","0.2.4":"2026-09-04T08:10:18.367Z","0.2.5":"2026-10-02T19:05:48.797Z","0.2.6":"2026-10-03T13:16:16.581Z","0.3.0":"2026-10-10T16:53:24.600Z","0.3.1":"2026-10-11T04:14:08.390Z","0.4.0":"2026-10-12T12:28:22.656Z","0.5.0":"2026-10-16T15:54:43.846Z","0.5.1":"2026-10-16T17:01:02.828Z","0.5.2":"2026-10-19T19:39:58.451Z"},"bugs":{"url":"https://mails.ai/contact"},"license":"MIT","homepage":"https://mails.ai","keywords":["email","ai","agent","mcp","mails.ai","agent-identity","sender-reputation","agent-email","prompt-injection","smtp","transactional-email"],"description":"Email API for AI agents — TypeScript SDK. Per-agent email addresses on your domain, per-agent reputation, and prompt-injection scanning on inbound mail. Send, receive structured inbound replies, and identify agents via REST. Intent + entity extraction is ","maintainers":[{"name":"mailsai","email":"dev@mails.ai"}],"readme":"# @mailsai/sdk\n\nEmail API for AI agents — TypeScript / JavaScript SDK.\n\nPer-agent email addresses on your domain, per-agent reputation, and prompt-injection scanning on inbound mail. Your agent reads the reply and decides what to say — intent + entity extraction is opt-in.\n\n```bash\nnpm install @mailsai/sdk\n```\n\nThe package is an ES module. `import` works on Node 18 and later. On Node 20.19+ or 22.12+,\n`require(\"@mailsai/sdk\")` works too, so a CommonJS project can use it as it is, including a\nTypeScript Playwright project without `\"type\": \"module\"`. On older Node, use `import`.\n\n## Quick start\n\nCreate the agent once (this gives it an inbox), then send from it. Skipping the\ncreate step is the most common first-run error — `mails.agent(\"sarah\")` only references\nan agent, it does not create one, so sending returns `404 agent_not_found`.\n\n```ts\nimport { mails, createClient } from \"@mailsai/sdk\";\n\n// One-time setup: create the agent. It receives mail at sarah.<your-workspace>@in.mails.ai\nconst client = createClient(); // reads MAILS_API_KEY from env\nawait client.agents.create(\"sarah\");\n\n// Reads MAILS_API_KEY from env (or pass via mails.agent(name, { apiKey: \"mk_live_...\" }))\nconst sarah = mails.agent(\"sarah\");\n\n// Send transactional mail: something the recipient asked for.\nawait sarah.send({\n  to: \"user@example.com\",\n  subject: \"Your password reset code\",\n  body: \"Your verification code is 481920. It expires in 10 minutes.\",\n});\n\nsarah.onReply((reply) => {\n  // A reply is scanned for prompt injection:\n  // reply.injection_score   → 0.02  (0 to 1; at 0.95 or more it is marked quarantined)\n  // reply.quarantined       → false\n  //\n  // A reply is not read for intent: that is for new mail (`onMessage`) to an agent with\n  // `classify_inbound` on (Pro and Scale include it at no extra charge). So on every reply:\n  // reply.intent            → \"general_reply\"\n  // reply.sender_reputation → 0.85  (0.3 when the reply scores as an injection attempt,\n  //                                  0.5 when it could not be scanned)\n  //\n  // Your agent reads the reply and decides what to send next.\n  console.log(reply.injection_score, reply.quarantined);\n});\n```\n\n## Lower-level client\n\nFor full access to every resource (messages, received mail and attachments, threads, labels, drafts, search, metrics, events, agents, webhooks, domains, API keys, suppression, reputation, billing, logs):\n\n```ts\nimport { createClient } from \"@mailsai/sdk\";\n\nconst client = createClient({ apiKey: process.env.MAILS_API_KEY! });\n\n// Send via any agent\nawait client.send(\"sarah\", { to: \"user@example.com\", subject: \"Your receipt\", body: \"…\" });\n\n// Or call resources directly\nconst threads = await client.threads.list({ agent_id: \"sarah\" }); // an agent's name or id (agt_…)\nconst usage = await client.billing.usage();\nconst reputation = await client.reputation.get(\"sarah\");\n\n// SSE stream of inbound events\nconst ctrl = client.events.stream({\n  event_types: [\"reply.received\", \"message.delivered\"],\n  onEvent: (e) => console.log(e.type, e),\n  onError: (err) => console.error(err),\n});\n// …later\nctrl.abort();\n```\n\nSearch, labels and attachments:\n\n```ts\nimport { writeFile } from \"node:fs/promises\";\n\nconst hits = await client.search({ q: \"invoice\", type: \"received\", has_attachment: true, after: new Date(\"2026-10-01\") });\n\nconst vip = await client.labels.create({ name: \"VIP\", color: \"red\" });\nawait client.threads.update(hits.data[0].thread_id!, { label_ids: [vip.id] });\n\nconst files = await client.received.attachments.list(hits.data[0].id);\nconst bytes = await client.received.attachments.download(hits.data[0].id, files.data[0].id); // Uint8Array\nawait writeFile(files.data[0].filename, bytes);\n```\n\n`events.list({ since })` (and `agent.listReplies({ since })`) takes a `Date` or an ISO 8601 string\nand sends it in the form every `created_at` has (`2026-10-04T09:30:00.000Z`). A plain date such\nas `2026-10-04` is sent as it is. A value that is not a time throws a `MailsError`\n(`param: \"since\"`) before any request is made, as the API would answer it 400. The stream's `since` is different: it is a position\nthe stream gave, or an event id (`evt_…`), to resume from.\n\nA stream reconnects by itself, from where the server said it was, and does not hand `onEvent` the\nsame event twice while it runs. Events arrive in id order, except one that was written late: it\narrives after newer ones instead of being skipped. To carry on after a restart, save the position\n`onPosition` gives you and pass it as `since`: an event id starts after that event, and a position\nstarts exactly where the stream was. Across a restart delivery is at least once, so keep the event\nids you handled if handling one twice would matter.\n\nEvery event type is listed on `TypedEvent.type`. An inbound event's `data` says how the sender was\nauthenticated, checked from the email itself and never from a header in it (`InboundAuthentication`):\n`dkim`, `dkim_domain`, `dmarc`, `spf` and `auth_failed`, which is true only on\n`message.received.unauthenticated`, the forged-sender event. It also says who the email is from\n(`InboundSender`). `from` is `{ address, name }`, the first mailbox of the From header: the address\nthose checks are about, and the one a reply goes to when there is no Reply-To. `envelope_from` is\nthe envelope sender, where bounces go, often a sending service's own address. `arc` is the email's\nARC chain as we checked it, and `trusted_forwarder` names the mail service whose ARC seal vouched\nfor the original sender of forwarded mail, or null.\n\n`agent.onMessage`, `agent.onReply`, `listMessages()` and `listReplies()` give an `InboundEvent`,\nwhose `data` always carries `from`, `subject`, `extracted_text`, `injection_categories` and\n`auth_failed`, so `event.data.from.address` needs no check or cast. `isInboundEvent(event)` narrows\nany other event to one, such as a verified webhook's.\n\n## Every method\n\nAll of these are on a client from `createClient()`, and each returns a Promise of the API's JSON\nunless the table says otherwise.\n\n**Messages you send**\n\n| Method | API call |\n|---|---|\n| `messages.send(input)`, also `send(input)` or `send(agent, input)` | `POST /v1/messages` |\n| `messages.batch(messages, { idempotency_key? })` | `POST /v1/messages/batch` |\n| `messages.list({ limit, cursor, agent_id, thread_id, q })` | `GET /v1/messages` |\n| `messages.get(id)` | `GET /v1/messages/{id}` |\n| `messages.reply(id, { body, …, idempotency_key? })` | `POST /v1/messages/{id}/reply` |\n| `messages.forward(id, { to, …, idempotency_key? })` | `POST /v1/messages/{id}/forward` |\n| `messages.reschedule(id, scheduled_at)` | `PATCH /v1/messages/{id}` |\n| `messages.cancel(id)` | `POST /v1/messages/{id}/cancel` |\n| `messages.raw(id)`, the message as an RFC 822 string | `GET /v1/messages/{id}/raw` |\n| `messages.appeal({ agent?, subject, body })` | `POST /v1/messages/appeal` |\n\n**Mail you receive**\n\n| Method | API call |\n|---|---|\n| `received.list({ limit, cursor, agent_id, thread_id, q, from, since })` | `GET /v1/messages/received` |\n| `received.wait({ agent_id, from, to, since, has, timeout })`, the newest match as soon as it arrives | `GET /v1/messages/received/wait` |\n| `received.get(id)` | `GET /v1/messages/received/{id}` |\n| `received.attachments.list(id)` | `GET /v1/messages/received/{id}/attachments` |\n| `received.attachments.download(id, attachmentId, { inline? })`, the bytes as a `Uint8Array` | `GET /v1/messages/received/{id}/attachments/{attachment_id}` |\n| `test.inbound({ agent, from, body_text, … })`, test keys only | `POST /v1/test/inbound` |\n\n**Threads, labels and search**\n\n| Method | API call |\n|---|---|\n| `threads.list({ limit, cursor, agent_id, status, folder, read, label, q })` | `GET /v1/threads` |\n| `threads.get(id)`, with its messages | `GET /v1/threads/{id}` |\n| `threads.update(id, { labels, label_ids, status, read, folder })` | `PATCH /v1/threads/{id}` |\n| `threads.remove(id, { permanent? })`, to trash or for good | `DELETE /v1/threads/{id}` |\n| `labels.list()` | `GET /v1/labels` |\n| `labels.create({ name, color? })` | `POST /v1/labels` |\n| `labels.get(id)` | `GET /v1/labels/{id}` |\n| `labels.update(id, { name?, color? })` | `PATCH /v1/labels/{id}` |\n| `labels.remove(id)` | `DELETE /v1/labels/{id}` |\n| `search({ q, agent_id, from, to, after, before, has_attachment, folder, label, type, limit, cursor })` | `GET /v1/search` |\n\nTo restore a trashed thread, move it back: `threads.update(id, { folder: \"inbox\" })`.\n\n**Drafts**\n\n| Method | API call |\n|---|---|\n| `drafts.create(input)` | `POST /v1/drafts` |\n| `drafts.list({ limit, cursor, agent_id, status })` | `GET /v1/drafts` |\n| `drafts.get(id)` | `GET /v1/drafts/{id}` |\n| `drafts.update(id, patch)` | `PATCH /v1/drafts/{id}` |\n| `drafts.remove(id)` | `DELETE /v1/drafts/{id}` |\n| `drafts.send(id, { send_at?, idempotency_key? })` | `POST /v1/drafts/{id}/send` |\n\n**Agents**\n\n| Method | API call |\n|---|---|\n| `agents.create(name, opts?)`, also `createAgent(name, opts?)` | `POST /v1/agents` |\n| `agents.create({ address, forwarding, ...opts })`, an agent at an address on your own verified domain | `POST /v1/agents` |\n| `agents.list({ limit, cursor, status })`, also `listAgents(opts?)` | `GET /v1/agents` |\n| `agents.get(id)` | `GET /v1/agents/{id}` |\n| `agents.update(id, patch)` | `PATCH /v1/agents/{id}` |\n| `agents.archive(id)` | `DELETE /v1/agents/{id}` |\n| `agents.inbox(id)`, unread and thread counts per folder and label | `GET /v1/agents/{id}/inbox` |\n| `agents.verifyForwarding(id)`, one test email through a forwarding-mode agent's forward | `POST /v1/agents/{id}/forwarding/verify` |\n\n**Events and webhooks**\n\n| Method | API call |\n|---|---|\n| `events.list({ limit, cursor, event_type, agent_id, since })` | `GET /v1/events` |\n| `events.get(id)` | `GET /v1/events/{id}` |\n| `events.redeliver(id)` | `POST /v1/events/{id}/redeliver` |\n| `events.stream({ event_types, since, onEvent, onError, onPosition })`, also `stream(opts)`; returns an `AbortController` | `GET /v1/events/stream` |\n| `webhooks.create({ url, event_types, description })` | `POST /v1/webhooks` |\n| `webhooks.list({ limit, cursor })` | `GET /v1/webhooks` |\n| `webhooks.get(id)` | `GET /v1/webhooks/{id}` |\n| `webhooks.update(id, { url, event_types, description, active })` | `PATCH /v1/webhooks/{id}` |\n| `webhooks.remove(id)` | `DELETE /v1/webhooks/{id}` |\n| `webhooks.rotateSecret(id)` | `POST /v1/webhooks/{id}/rotate-secret` |\n| `webhooks.deliveries(id, { limit, cursor })` | `GET /v1/webhooks/{id}/deliveries` |\n| `webhooks.test(id)` | `POST /v1/webhooks/{id}/test` |\n| `webhooks.replayDelivery(deliveryId)` | `POST /v1/webhook-deliveries/{id}/replay` |\n| `webhooks.verify(body, signature, secret)`, also `mails.webhooks.verify`; no request | none |\n\n**Domains, keys and suppression**\n\n| Method | API call |\n|---|---|\n| `domains.create(domain)` | `POST /v1/domains` |\n| `domains.list()` | `GET /v1/domains` |\n| `domains.get(id)` | `GET /v1/domains/{id}` |\n| `domains.verify(id)` | `POST /v1/domains/{id}/verify` |\n| `domains.remove(id)` | `DELETE /v1/domains/{id}` |\n| `api_keys.create({ name, agent_id, scopes, mode, expires_at })` | `POST /v1/api-keys` |\n| `api_keys.list({ limit, cursor })` | `GET /v1/api-keys` |\n| `api_keys.revoke(id)` | `DELETE /v1/api-keys/{id}` |\n| `connected_apps.list({ limit, cursor })` | `GET /v1/oauth/grants` |\n| `connected_apps.revoke(id)` | `DELETE /v1/oauth/grants/{id}` |\n| `suppression.check(address)` | `GET /v1/suppression?address=…` |\n| `suppression.list({ limit, cursor, view? })`, `view: \"suppressed\"` for suppressed recipients | `GET /v1/suppression` |\n| `suppression.allow(address, attestation)` | `POST /v1/suppression/allow` |\n| `suppression.revoke(id)` | `DELETE /v1/suppression/allow/{id}` |\n\n**Account**\n\n| Method | API call |\n|---|---|\n| `me()` | `GET /v1/me` |\n| `metrics.get({ from, to, agent_id, interval })` | `GET /v1/metrics` |\n| `reputation.get(agentId?)` | `GET /v1/reputation` |\n| `billing.usage()` | `GET /v1/billing/usage` |\n| `billing.portal(returnUrl?, { price_lookup_key? })` | `POST /v1/billing/portal` |\n| `logs.list({ limit, cursor, category, action })` | `GET /v1/logs` |\n| `health()` | `GET /api/health` |\n\n**The agent helper** (`mails.agent(name)` or `client.agent(name)`): `send(input)`,\n`listReplies({ limit, since })`, `listMessages({ limit, since })`, `reputation()`,\n`onReply(callback)` and `onMessage(callback)`. `name` is the agent's name or its id (`agt_…`).\nWhen two agents share a name (one at `<workspace>.mails.ai` and one on your own domain), a key\ntied to one of them means that one. A workspace key sends from the older one, and its reads\nand listeners are refused with 409 `agent_name_conflict`: pass the id instead. A listener\nhands that error, and a name no agent has, to its `onError`; with no `onError` it is written\nto `console.error` once.\n\n**A key tied to one agent** (`api_keys.create({ agent_id })`) reads and sends as that agent\nonly. Calls that read across the whole workspace (`billing.usage()`, `logs.list()`,\n`connected_apps.list()`) or change it (webhooks, labels, domains, connected apps, revoking\nkeys, creating agents, send-anyway entries) throw `MailsError` with status 403 and code\n`insufficient_scope`. `metrics.get()` counts only that agent's mail, and naming another agent\nin `agent_id` throws the same error. `agents.list()` returns that agent only, `api_keys.list()`\nonly the keys tied to it, and `agents.get()` of any other agent throws `MailsError` with status\n404 and code `agent_not_found`, as if it did not exist.\n\n## Webhook verification\n\n```ts\nimport { mails } from \"@mailsai/sdk\";\n\n// In your webhook handler:\nconst event = mails.webhooks.verify(\n  rawBody,\n  req.headers[\"x-mails-signature\"]!,\n  process.env.MAILS_WEBHOOK_SECRET!\n);\nif (!event) return new Response(\"invalid signature\", { status: 400 });\n// event is the verified inbound event payload\n```\n\n## Configuration\n\n| Option | Env var | Default |\n|---|---|---|\n| `apiKey` | `MAILS_API_KEY` | none — required |\n| `baseUrl` | `MAILS_BASE_URL` | `https://api.mails.ai` |\n| `fetch` | — | global `fetch` |\n| `maxRetryWaitSeconds` | — | `60` (at most 60) |\n\n## Rate limits and retries\n\nA rate-limited call (429), and a 5xx on a read or on a write with an idempotency key, is retried\nup to three times. The API sends `Retry-After` only when the limit lifts within 60 seconds, and\nthe client sleeps that long, up to `maxRetryWaitSeconds` (60 by default, and never more than 60).\n\nWhen the limit lifts later (an hourly window that will not clear within the minute, a daily or\nmonthly cap), the error body says when: `resets_at` and `retry_after_seconds`. The client then\ndoes not sleep. It throws a `RateLimitError` at once, with `resetsAt` (an ISO 8601 time) and\n`retryAfterSeconds` set and both named in the message, so a long limit never looks like a hung\ncall. `resetsAt` is `null` when waiting never lifts the limit (a plan cap that only an upgrade\ndoes). `RateLimitError` is a `MailsError`, so code that catches `MailsError` still catches it.\n\n## Idempotency\n\n```ts\nawait sarah.send({\n  to: \"user@example.com\",\n  subject: \"Your receipt\",\n  body: \"…\",\n  idempotency_key: \"receipt-order-10473\",\n});\n```\n\nReplays within 24 hours return the original response with `Idempotent-Replay: true` header.\n`messages.reply`, `messages.forward` and `drafts.send` take `idempotency_key` the same way, and\n`messages.batch` takes it in its second argument (`{ idempotency_key }`).\n\n## Sign-up codes and links\n\nA received message carries `codes` and `links`, picked out of its text and HTML by fixed rules, with no AI involved. Each code is a `value`, the likeliest first. Each link is a `url` and a `kind` (`verify`, `sign_in`, `reset_password`, `unsubscribe` or `other`), the action links first.\n\n`received.wait()` answers as soon as a matching message arrives, so an agent that has just asked a service for a code reads it in one call:\n\n```ts\nconst askedAt = new Date().toISOString();\n// …the agent signs up somewhere with its mails.ai address…\nconst { message } = await client.received.wait({ from: \"github.com\", has: \"code\", since: askedAt, timeout: 50 });\nconst code = message?.codes?.[0]?.value; // undefined: nothing arrived in 50 seconds\n```\n\n`from` is an address or a domain, and a domain includes its subdomains. `has` is `\"code\"`, or `\"link\"` for a `verify`, `sign_in` or `reset_password` link. `timeout` is 0 to 50 seconds (default 30), and without `since` it looks back 5 minutes. Mail judged forged and quarantined mail never match. Nothing in time is not an error: `message` is null and `timed_out` is true.\n\n### One address per sign-up or test run\n\nMail to any plus address of an agent's `receiving_address` reaches the agent too, so each sign-up or test run can have an address of its own, and wait for that address's mail alone. `plusAddress()` builds one, and `to` takes only mail sent to it:\n\n```ts\nimport { plusAddress } from \"@mailsai/sdk\";\n\nconst email = plusAddress(agent.receiving_address, `run-${Date.now()}`); // qa.acme+run-1792…@in.mails.ai\n// …sign up with `email`…\nconst { message } = await client.received.wait({ to: email, has: \"code\", timeout: 50 });\n```\n\nEach received message says which address it came to in `delivered_to`, and `received.list({ to })` takes the same filter. A workspace may receive mail at 20 different plus addresses a day on Free, 1,000 on Pro and 10,000 on Scale. Past that, mail to a new one keeps only a record (`over_limit: \"plus_address_limit\"`) and raises `message.received.over_limit`, while the addresses already used that day keep working. A sign-in code or link from a service such as Google, Microsoft, Apple, a payment app or a bank never reaches a plus address either: such mail keeps only a record (`over_limit: \"held_code\"`), so sign up for those services at the agent's own address.\n\n## Attachments\n\nUp to 10 files and 25 MB in all. Give each file's bytes, or an https URL that mails.ai downloads when it sends, and give a file a `content_id` to show it inside the HTML instead of attaching it. Bytes travel inside the request, so together they can come to about 3 MB: give a larger file by its URL. A batch cannot carry attachments, so send a message with files on its own:\n\n```ts\nimport { readFileSync } from \"node:fs\";\n\nawait sarah.send({\n  to: \"dana@example.com\",\n  subject: \"Your invoice\",\n  body_html: '<img src=\"cid:logo\" alt=\"Acme\"><p>Your invoice is attached.</p>',\n  attachments: [\n    { filename: \"logo.png\", path: \"https://files.example.com/logo.png\", content_id: \"logo\" },\n    { filename: \"invoice-221.pdf\", content_base64: readFileSync(\"invoice-221.pdf\").toString(\"base64\"), content_type: \"application/pdf\" },\n  ],\n});\n```\n\nA `path` must answer within 10 seconds, after at most 3 redirects, each to https, and never at a private, loopback or link-local address. A file that cannot be fetched refuses the whole send with a 400 `invalid_field` error whose `param` names it (`attachments.0.path`), and nothing is sent. `content_type` is optional with `path`: the type the URL answers with is used. A send with a future `scheduled_at` cannot carry attachments yet.\n\n## One-click unsubscribe\n\nSends carry no unsubscribe headers unless you ask. For a newsletter or digest, opt in:\n\n```ts\nawait sarah.send({\n  to: \"reader@example.com\",\n  subject: \"This week's digest\",\n  body: \"…\",\n  list_unsubscribe: true,\n});\n```\n\nThe message then carries `List-Unsubscribe` and `List-Unsubscribe-Post: List-Unsubscribe=One-Click`, and the recipient's mail app shows an Unsubscribe button. One click suppresses that address for your whole workspace, so later sends to it are refused with `recipient_suppressed`. Leave it off for password resets, sign-in links and receipts. It needs exactly one `to` recipient and no `cc` or `bcc`.\n\n## Errors\n\nAll API errors throw `MailsError`; a 429 throws its subclass `RateLimitError`:\n\n```ts\nimport { MailsError, RateLimitError } from \"@mailsai/sdk\";\n\ntry {\n  await sarah.send({ to: \"blocked@example.com\", subject: \"…\", body: \"…\" });\n} catch (err) {\n  if (err instanceof RateLimitError) {\n    console.error(err.resetsAt ? `rate limited until ${err.resetsAt}` : err.message);\n  } else if (err instanceof MailsError) {\n    console.error(err.type, err.code, err.message, err.status, err.requestId);\n  }\n}\n```\n\nA 402 (a plan limit, or a feature your plan does not include) also carries `upgradeUrl`, the\npage where the plan can be changed, and its message ends with that link.\n\nA send that succeeds answers `status` `sent`, `scheduled` (a future `scheduled_at`), or\n`delivered` when delivery to every recipient was confirmed at once (with a live key, a send\nonly to the test address `reply@test.mails.ai` always is; a test key's sends answer `sent`). A\nsend that fails throws instead.\n\n## Documentation\n\n- Full docs: [mails.ai/docs](https://mails.ai/docs)\n- API reference: [mails.ai/docs/api](https://mails.ai/docs)\n- Source: [github.com/mailsai/mailsai](https://github.com/mailsai/mailsai/tree/main/packages/sdk)\n\n## License\n\nMIT\n","readmeFilename":"README.md"}