SuperMailOS Threads API

The Threads API from SuperMailOS — 3 operation(s) for threads.

GitHub OpenAPI

Operations 4

GET /api/v1/threads List threads #
GET /api/v1/threads/{id} Get a thread #
PATCH /api/v1/threads/{id} Update a thread #
GET /api/v1/search Search mail #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/supermailos-com:supermailos-com-threads-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

supermailos-com-threads-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: SuperMailOS Threads API
  version: 1.3.0
  description: 'The SuperMailOS API lets your code and AI agents read, search, organize and send

    business email from your workspace''s real mailboxes — the same mail, rules and

    guardrails as the web app. ## Authentication

    Create a key in **Settings → Developers → API keys** (workspace admins). Keys look

    like `smk_…`, are shown once, and are sent as `Authorization: Bearer `. Prefer calling from a server; never ship a key in public client code. A key acts for the person who created it and reaches exactly the mailboxes they

    can open in the app: owners and admins reach every mailbox in the workspace; a

    member reaches their own mailboxes plus mailboxes shared with them (view-only,

    view-and-send, or full access). Anything else — another workspace, a teammate''s

    unshared mailbox — is reported as `404`, never as forbidden. Access follows the

    person''s current role, and a key stops working (`401`) once its creator leaves

    the workspace. ## Scopes

    | Scope | Allows |

    |---|---|

    | `read` | mailboxes, threads, messages, attachments, search |

    | `send` | `POST /send`, `POST /threads/{id}/reply` |

    | `write` | `PATCH /threads/{id}` (read/unread, star, move, archive, labels), `POST /threads/{id}/draft`, managing agent inboxes, their keys and held mail, rejecting an agent''s email — never sends |

    | `send` (also) | approving an agent''s waiting email (`POST /approvals/{id}/approve`) |


    A request without the needed scope gets `403` with code `missing_scope`. ## Rate limits

    120 requests per minute per key and 60 per minute per IP, then a

    one-minute cooldown. Responses carry `X-RateLimit-Limit` / `X-RateLimit-Remaining`;

    a `429` carries `Retry-After` (seconds). Sending has its own per-mailbox and

    per-workspace hourly limits and new-domain warm-up caps (also `429`). ## Idempotency

    Send an `Idempotency-Key` header (any 1–255 printable ASCII characters — a UUID

    is ideal) on `POST /send` and `POST /threads/{id}/reply`. Keys are scoped to your

    API key and kept for 24 hours:

    - same key + same body → the original response is replayed (same status and

    JSON, plus `Idempotency-Replayed: true`); nothing is sent again;

    - same key + a different body → `422` `idempotency_key_reused`;

    - same key while the first request is still running → `409` `idempotency_in_progress`. Only successful responses are stored: a refused request sent nothing, so you may

    fix it and retry with the same key. Always retry sends with the key you first used. ## Errors

    Errors are JSON: `{ "error": "", "code": "" }`. `error` is for

    humans and may change; `code` is stable: `bad_request`, `unauthorized`, `missing_scope`, `forbidden`, `not_found`, `conflict`, `idempotency_in_progress`, `idempotency_key_reused`, `payload_too_large`, `unprocessable`, `locked`, `rate_limited`, `insufficient_storage`, `server_error`, `upstream_failed`, `limit_reached`. A `503` `server_error` with `Retry-After` means the service is briefly unavailable:

    retry, and keep the key — only `401` says it is invalid. ## Pagination

    List endpoints return `nextCursor`; pass it back as `?cursor=` for the next page

    (`null` on the last page). `limit` is 1–100 (default 25). ## Privacy

    Bcc recipients appear only to the person who sent the message or was themselves

    Bcc''d — the same rule as the app. Reading a thread over the API never marks it

    read; `PATCH` it to change state. ## Ids

    Thread, message and attachment ids are opaque strings. A message''s `id` is the

    same value webhooks send as `emailId`; `messageId` is the RFC 5322 Message-ID. ## Agent inboxes

    Give an AI agent its own inbox on your domain (`POST /inboxes`), with a person who

    sponsors it and guardrails on by default. Its id is its mailbox id, so every mail

    endpoint above works with it. An **agent key** (`POST /inboxes/{id}/keys`, or

    `createKey` on create) reaches that one inbox and nothing else.'
  contact:
    name: SuperMailOS
    url: https://supermailos.com/contact
servers:
- url: https://supermailos.com
  description: Production
security:
- bearerAuth: []
tags:
- name: Threads
paths:
  /api/v1/threads:
    get:
      operationId: listThreads
      tags:
      - Threads
      summary: List threads
      description: Conversations across the mailboxes this key can read, newest first. Never marks anything read.
      parameters:
      - $ref: '#/components/parameters/Mailbox'
      - $ref: '#/components/parameters/Folder'
      - name: unread
        in: query
        schema:
          type: boolean
        description: '`true` → only unread conversations.'
      - name: label
        in: query
        schema:
          type: string
      - name: hasAttachments
        in: query
        schema:
          type: boolean
      - name: q
        in: query
        schema:
          type: string
          maxLength: 500
        description: Search query (see `/search`). With `q` and no `folder`, every folder but trash and spam is searched.
      - $ref: '#/components/parameters/Cursor'
      - $ref: '#/components/parameters/Limit'
      responses:
        '200':
          description: A page of threads.
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ThreadList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
      - bearerAuth: []
      x-required-scope: read
      x-codeSamples:
      - lang: curl
        label: curl
        source: "curl \"https://supermailos.com/api/v1/threads?folder=inbox&unread=true&limit=25\" \\\n  -H \"Authorization: Bearer $SUPERMAILOS_API_KEY\""
      - lang: TypeScript
        label: TypeScript
        source: "const res = await fetch(\"https://supermailos.com/api/v1/threads?folder=inbox&unread=true&limit=25\", {\n  method: \"GET\",\n  headers: {\n    Authorization: `Bearer ${process.env.SUPERMAILOS_API_KEY}`,\n  },\n});\nif (!res.ok) throw new Error(`${res.status}: ${(await res.json()).error}`);\nconst data = await res.json();"
      - lang: Python
        label: Python
        source: "import os\nimport requests\n\nres = requests.get(\n    \"https://supermailos.com/api/v1/threads\",\n    params={\n        \"folder\": \"inbox\",\n        \"unread\": \"true\",\n        \"limit\": \"25\",\n    },\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['SUPERMAILOS_API_KEY']}\",\n    },\n    timeout=30,\n)\nres.raise_for_status()\ndata = res.json()"
  /api/v1/threads/{id}:
    get:
      operationId: getThread
      tags:
      - Threads
      summary: Get a thread
      description: One conversation with every message, oldest first. Does not mark it read.
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: Thread id.
      - $ref: '#/components/parameters/Html'
      responses:
        '200':
          description: The thread.
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ThreadDetail'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
      - bearerAuth: []
      x-required-scope: read
      x-codeSamples:
      - lang: curl
        label: curl
        source: "curl \"https://supermailos.com/api/v1/threads/THREAD_ID\" \\\n  -H \"Authorization: Bearer $SUPERMAILOS_API_KEY\""
      - lang: TypeScript
        label: TypeScript
        source: "const res = await fetch(\"https://supermailos.com/api/v1/threads/THREAD_ID\", {\n  method: \"GET\",\n  headers: {\n    Authorization: `Bearer ${process.env.SUPERMAILOS_API_KEY}`,\n  },\n});\nif (!res.ok) throw new Error(`${res.status}: ${(await res.json()).error}`);\nconst data = await res.json();"
      - lang: Python
        label: Python
        source: "import os\nimport requests\n\nres = requests.get(\n    \"https://supermailos.com/api/v1/threads/THREAD_ID\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['SUPERMAILOS_API_KEY']}\",\n    },\n    timeout=30,\n)\nres.raise_for_status()\ndata = res.json()"
    patch:
      operationId: updateThread
      tags:
      - Threads
      summary: Update a thread
      description: 'Mark read/unread (needs read access), star, move (inbox, archive, trash, spam) or relabel (need manage access: the mailbox''s owner, an admin, or a full-access share). Returns the updated thread.'
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: Thread id.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ThreadPatch'
      responses:
        '200':
          description: Updated.
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
          content:
            application/json:
              schema:
                type: object
                required:
                - thread
                properties:
                  thread:
                    $ref: '#/components/schemas/Thread'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/Unprocessable'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
      - bearerAuth: []
      x-required-scope: write
      x-codeSamples:
      - lang: curl
        label: curl
        source: "curl -X PATCH \"https://supermailos.com/api/v1/threads/THREAD_ID\" \\\n  -H \"Authorization: Bearer $SUPERMAILOS_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"unread\":false,\"folder\":\"archive\",\"addLabels\":[\"Invoices\"]}'"
      - lang: TypeScript
        label: TypeScript
        source: "const res = await fetch(\"https://supermailos.com/api/v1/threads/THREAD_ID\", {\n  method: \"PATCH\",\n  headers: {\n    Authorization: `Bearer ${process.env.SUPERMAILOS_API_KEY}`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"unread\": false,\n    \"folder\": \"archive\",\n    \"addLabels\": [\n      \"Invoices\"\n    ]\n  }),\n});\nif (!res.ok) throw new Error(`${res.status}: ${(await res.json()).error}`);\nconst data = await res.json();"
      - lang: Python
        label: Python
        source: "import os\nimport requests\n\nres = requests.patch(\n    \"https://supermailos.com/api/v1/threads/THREAD_ID\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['SUPERMAILOS_API_KEY']}\",\n    },\n    json={\n        \"unread\": False,\n        \"folder\": \"archive\",\n        \"addLabels\": [\"Invoices\"],\n    },\n    timeout=30,\n)\nres.raise_for_status()\ndata = res.json()"
  /api/v1/search:
    get:
      operationId: searchMail
      tags:
      - Threads
      summary: Search mail
      description: 'Full-text search with operators: `from:`, `to:`, `subject:`, `label:`, `has:attachment`, `is:unread`, `is:starred`, `before:YYYY-MM-DD`, `after:YYYY-MM-DD`, quoted phrases. Searches every folder except trash and spam unless `folder` is given.'
      parameters:
      - name: q
        in: query
        required: true
        schema:
          type: string
          maxLength: 500
      - $ref: '#/components/parameters/Mailbox'
      - $ref: '#/components/parameters/Folder'
      - $ref: '#/components/parameters/Cursor'
      - $ref: '#/components/parameters/Limit'
      responses:
        '200':
          description: Matching threads.
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ThreadList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
      - bearerAuth: []
      x-required-scope: read
      x-codeSamples:
      - lang: curl
        label: curl
        source: "curl \"https://supermailos.com/api/v1/search?q=from%3Abilling+has%3Aattachment+after%3A2026-01-01&limit=10\" \\\n  -H \"Authorization: Bearer $SUPERMAILOS_API_KEY\""
      - lang: TypeScript
        label: TypeScript
        source: "const res = await fetch(\"https://supermailos.com/api/v1/search?q=from%3Abilling+has%3Aattachment+after%3A2026-01-01&limit=10\", {\n  method: \"GET\",\n  headers: {\n    Authorization: `Bearer ${process.env.SUPERMAILOS_API_KEY}`,\n  },\n});\nif (!res.ok) throw new Error(`${res.status}: ${(await res.json()).error}`);\nconst data = await res.json();"
      - lang: Python
        label: Python
        source: "import os\nimport requests\n\nres = requests.get(\n    \"https://supermailos.com/api/v1/search\",\n    params={\n        \"q\": \"from:billing has:attachment after:2026-01-01\",\n        \"limit\": \"10\",\n    },\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['SUPERMAILOS_API_KEY']}\",\n    },\n    timeout=30,\n)\nres.raise_for_status()\ndata = res.json()"
components:
  responses:
    Unauthorized:
      description: Missing, invalid or revoked API key.
      headers: {}
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BadRequest:
      description: The request is malformed.
      headers: {}
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The key lacks the scope (`missing_scope`) or the access (`forbidden`).
      headers: {}
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Too many requests.
      headers:
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Not found — or not reachable with this key.
      headers: {}
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unprocessable:
      description: Valid JSON the server can't act on (e.g. unverified domain, suppressed recipient, reused Idempotency-Key).
      headers: {}
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  headers:
    Retry-After:
      description: Seconds to wait before retrying.
      schema:
        type: integer
    X-RateLimit-Limit:
      description: Requests allowed per minute for this key.
      schema:
        type: integer
    X-RateLimit-Remaining:
      description: Requests left in the current minute.
      schema:
        type: integer
  schemas:
    ThreadDetail:
      type: object
      required:
      - thread
      - messages
      - permissions
      properties:
        thread:
          $ref: '#/components/schemas/Thread'
        messages:
          type: array
          items:
            $ref: '#/components/schemas/Message'
          description: Oldest first.
        permissions:
          type: object
          required:
          - send
          - manage
          properties:
            send:
              type: boolean
            manage:
              type: boolean
    ThreadPatch:
      type: object
      additionalProperties: false
      minProperties: 1
      properties:
        unread:
          type: boolean
          description: Needs read access.
        read:
          type: boolean
          description: Alias for `!unread`.
        starred:
          type: boolean
        folder:
          type: string
          enum:
          - inbox
          - archive
          - trash
          - spam
          description: Move to a system folder. `spam` also trains the mailbox on the sender; `spam` → `inbox` forgives them.
        labels:
          type: array
          items:
            type: string
            maxLength: 60
          maxItems: 20
          description: Replace every label.
        addLabels:
          type: array
          items:
            type: string
            maxLength: 60
        removeLabels:
          type: array
          items:
            type: string
          description: Case-insensitive.
    Message:
      type: object
      required:
      - id
      - threadId
      - mailboxId
      - direction
      - from
      - to
      - cc
      - subject
      - date
      - read
      - text
      - attachments
      properties:
        id:
          type: string
          description: 'Internal message id (webhooks: `emailId`).'
        threadId:
          type: string
        mailboxId:
          type: string
        direction:
          type: string
          enum:
          - inbound
          - outbound
        messageId:
          type: string
          description: RFC 5322 Message-ID header, e.g. `<abc@acme.com>`.
        from:
          $ref: '#/components/schemas/EmailAddress'
        to:
          type: array
          items:
            $ref: '#/components/schemas/EmailAddress'
        cc:
          type: array
          items:
            $ref: '#/components/schemas/EmailAddress'
        bcc:
          type: array
          items:
            $ref: '#/components/schemas/EmailAddress'
          description: Present only when the key's user sent the message or was Bcc'd on it.
        replyTo:
          type: array
          items:
            $ref: '#/components/schemas/EmailAddress'
          description: 'Received mail''s Reply-To, when it named one: where its author asked replies to go. Replying through the API uses it instead of `from`.'
        subject:
          type: string
        date:
          type: string
          format: date-time
        read:
          type: boolean
        text:
          type: string
          description: Plain-text body.
        html:
          type: string
          description: HTML body with scripts and event handlers removed (omitted with `?html=false`).
        attachments:
          type: array
          items:
            $ref: '#/components/schemas/Attachment'
        auth:
          type: object
          description: 'Present only when we verified the sender ourselves: mail someone in the workspace sent from their own mailbox (all three `pass`). Absent on other received mail: the mail server doesn''t give the app an SPF / DKIM / DMARC verdict, so none is claimed.'
          properties:
            spf:
              type: string
            dkim:
              type: string
            dmarc:
              type: string
        deliveredAt:
          type: string
          format: date-time
          description: When the recipient's server accepted an outbound message.
        trust:
          type: object
          description: 'Agent keys only. `sender`: our own SPF/DKIM/DMARC verdict (`verified`, `unverified`, `failed`; `self` for mail this inbox sent). `hiddenContent`: the email carried text a person wouldn''t see — `text`/`html` are the visible part only.'
          required:
          - sender
          - hiddenContent
          properties:
            sender:
              type: string
              enum:
              - verified
              - unverified
              - failed
              - self
            hiddenContent:
              type: boolean
            signals:
              type: array
              items:
                type: string
              description: What was removed, e.g. `2 hidden elements`.
    Thread:
      type: object
      required:
      - id
      - mailboxId
      - mailbox
      - receivedOn
      - subject
      - snippet
      - from
      - participants
      - folder
      - unread
      - starred
      - labels
      - lastMessageAt
      - hasAttachments
      - messageCount
      properties:
        id:
          type: string
        mailboxId:
          type: string
        mailbox:
          type: string
          format: email
          description: The mailbox's address.
        receivedOn:
          type: string
          format: email
          description: Where the conversation arrived (an alias, if so) or the address it was sent from.
        subject:
          type: string
        snippet:
          type: string
        from:
          $ref: '#/components/schemas/EmailAddress'
          description: 'The other party: latest inbound sender, else the first recipient of the latest sent message.'
        participants:
          type: array
          items:
            $ref: '#/components/schemas/EmailAddress'
          description: From/To/Cc of every message — never Bcc.
        folder:
          type: string
          enum:
          - inbox
          - sent
          - drafts
          - archive
          - spam
          - trash
        unread:
          type: boolean
        starred:
          type: boolean
        labels:
          type: array
          items:
            type: string
        lastMessageAt:
          type: string
          format: date-time
        snoozedUntil:
          type: string
          format: date-time
        hasAttachments:
          type: boolean
        messageCount:
          type: integer
    Error:
      type: object
      required:
      - error
      - code
      properties:
        error:
          type: string
          description: Human-readable message.
        code:
          type: string
          description: Stable machine-readable code.
          enum:
          - bad_request
          - unauthorized
          - missing_scope
          - forbidden
          - not_found
          - conflict
          - idempotency_in_progress
          - idempotency_key_reused
          - payload_too_large
          - unprocessable
          - locked
          - rate_limited
          - insufficient_storage
          - server_error
          - upstream_failed
          - limit_reached
    Attachment:
      type: object
      required:
      - id
      - filename
      - contentType
      - size
      - inline
      - url
      properties:
        id:
          type: string
        filename:
          type: string
        contentType:
          type: string
        size:
          type: integer
          description: Bytes.
        inline:
          type: boolean
          description: Embedded in the HTML body via `cid:` rather than attached as a file.
        contentId:
          type: string
          description: Matches `cid:` references in the HTML body.
        url:
          type: string
          description: Download path (`GET`, same bearer key).
    EmailAddress:
      type: object
      required:
      - email
      properties:
        email:
          type: string
          format: email
        name:
          type: string
    ThreadList:
      type: object
      required:
      - threads
      - nextCursor
      - unread
      properties:
        threads:
          type: array
          items:
            $ref: '#/components/schemas/Thread'
        nextCursor:
          type:
          - string
          - 'null'
          description: Pass as `cursor` for the next page.
        unread:
          type: integer
          description: Unread conversations matching the filters (all pages).
  parameters:
    Html:
      name: html
      in: query
      schema:
        type: boolean
        default: true
      description: '`false` omits HTML bodies (smaller responses).'
    Folder:
      name: folder
      in: query
      schema:
        type: string
        enum:
        - inbox
        - sent
        - drafts
        - archive
        - spam
        - trash
        - starred
        - snoozed
        - all
      description: Default `inbox` (`all` = everything but trash and spam).
    Limit:
      name: limit
      in: query
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 25
    Cursor:
      name: cursor
      in: query
      schema:
        type: string
      description: '`nextCursor` from the previous page.'
    Mailbox:
      name: mailbox
      in: query
      schema:
        type: string
      description: Mailbox id, address, or alias address.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: smk_…
      description: A workspace API key from Settings → Developers → API keys.
externalDocs:
  description: Quick reference (agent skill)
  url: https://supermailos.com/.well-known/agent-skills/supermailos/SKILL.md