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. See our Privacy Policy and
Terms.
openapi: 3.2.0
info:
title: OpenMail Attachments API
description: Email infrastructure API for AI agents. Create inboxes, send and receive email, and get real-time notifications via webhooks.
version: 1.0.0
license:
name: Proprietary
servers:
- url: https://api.openmail.sh
security:
- bearerAuth: []
tags:
- name: Attachments
description: Downloading and extracting text from attachments
paths:
/v1/attachments/{messageId}/{filename}:
get:
operationId: getAttachment
summary: Download attachment
tags:
- Attachments
description: 'Returns the attachment bytes. Authenticate with `Authorization: Bearer `. The response is the file itself (not a redirect), so clients can fetch the URL from `attachments[].url` with the same API key they use for the rest of the API.'
parameters:
- schema:
type: string
in: path
name: messageId
required: true
- schema:
type: string
in: path
name: filename
required: true
responses:
'200':
description: Attachment file bytes
content:
application/octet-stream:
schema:
type: string
format: binary
'404':
description: Attachment not found
content:
application/json:
schema:
description: Attachment not found
allOf:
- $ref: '#/components/schemas/Error'
/v1/attachments/{messageId}/{filename}/text:
get:
operationId: getAttachmentText
summary: Extract attachment text
tags:
- Attachments
description: Extracts and returns the plain text content of an attachment. Supports PDF, DOCX, XLSX, PPTX, images (via OCR), and other common formats. The result is cached on the message after the first extraction.
parameters:
- schema:
type: string
in: path
name: messageId
required: true
- schema:
type: string
in: path
name: filename
required: true
responses:
'200':
description: Extracted text content
content:
application/json:
schema:
description: Extracted text content
type: object
additionalProperties: true
properties:
filename:
type: string
inboxId:
type: string
description: Inbox the parent message belongs to
contentType:
type: string
extractionMethod:
type: string
description: Method used to extract text (e.g. pdf, docx, ocr)
text:
type: string
'404':
description: Attachment not found
content:
application/json:
schema:
description: Attachment not found
allOf:
- $ref: '#/components/schemas/Error'
'422':
description: Text could not be extracted from the attachment
content:
application/json:
schema:
description: Text could not be extracted from the attachment
allOf:
- $ref: '#/components/schemas/Error'
components:
schemas:
Error:
type: object
additionalProperties: true
properties:
error:
type: string
message:
type: string
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: API key