Back to Documentation
Documentationapi reference

API Reference

Complete API documentation for Pupam's REST API

2 min read
Last updated: Recently updated

API Reference

The Pupam API allows you to integrate email management capabilities into your applications.

Authentication

All API requests require authentication using an API key.

Getting Your API Key

  1. Log in to your Pupam account
  2. Go to SettingsAPI Keys
  3. Click Generate New Key
  4. Copy your key and store it securely

Making Authenticated Requests

Include your API key in the request headers:

curl https://api.pupam.com/v1/emails \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Base URL

https://api.pupam.com/v1

Rate Limits

PlanRequests per Hour
Free1,000
Pro10,000
Enterprise100,000

Emails

List Emails

Retrieve a list of emails from your inbox.

Endpoint: GET /emails

Query Parameters:

ParameterTypeDescriptionDefault
folderstringFilter by folder IDall
statusstringread, unread, starredall
limitintegerNumber of results (max 100)25
offsetintegerPagination offset0
sortstringdate, subject, fromdate
orderstringasc, descdesc

Example Request:

curl https://api.pupam.com/v1/emails?limit=10&status=unread \
  -H "Authorization: Bearer YOUR_API_KEY"

Example Response:

{
  "data": [
    {
      "id": "email_abc123",
      "subject": "Welcome to Pupam",
      "from": {
        "email": "hello@pupam.com",
        "name": "Pupam Team"
      },
      "to": [
        {
          "email": "user@example.com",
          "name": "John Doe"
        }
      ],
      "date": "2025-10-24T10:30:00Z",
      "status": "unread",
      "folder": "inbox",
      "has_attachments": false,
      "snippet": "Thank you for signing up for Pupam..."
    }
  ],
  "meta": {
    "total": 150,
    "limit": 10,
    "offset": 0
  }
}

Get Email

Retrieve a specific email by ID.

Endpoint: GET /emails/:id

Example Request:

curl https://api.pupam.com/v1/emails/email_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY"

Example Response:

{
  "id": "email_abc123",
  "subject": "Welcome to Pupam",
  "from": {
    "email": "hello@pupam.com",
    "name": "Pupam Team"
  },
  "to": [
    {
      "email": "user@example.com",
      "name": "John Doe"
    }
  ],
  "cc": [],
  "bcc": [],
  "date": "2025-10-24T10:30:00Z",
  "status": "read",
  "folder": "inbox",
  "labels": ["welcome", "onboarding"],
  "has_attachments": false,
  "body": {
    "html": "<html>...</html>",
    "text": "Welcome to Pupam..."
  },
  "attachments": []
}

Send Email

Send a new email.

Endpoint: POST /emails

Request Body:

{
  "to": [
    {
      "email": "recipient@example.com",
      "name": "Jane Smith"
    }
  ],
  "subject": "Hello from Pupam API",
  "body": {
    "html": "<p>This is a test email</p>",
    "text": "This is a test email"
  },
  "cc": [],
  "bcc": [],
  "attachments": []
}

Example Request:

curl -X POST https://api.pupam.com/v1/emails \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": [{"email": "recipient@example.com"}],
    "subject": "Hello",
    "body": {"text": "Hello World"}
  }'

Example Response:

{
  "id": "email_xyz789",
  "status": "sent",
  "message": "Email sent successfully"
}

Update Email

Update email properties (mark as read, star, move folder, etc.).

Endpoint: PATCH /emails/:id

Request Body:

{
  "status": "read",
  "starred": true,
  "folder": "archive",
  "labels": ["important", "follow-up"]
}

Example Response:

{
  "id": "email_abc123",
  "status": "read",
  "starred": true,
  "folder": "archive",
  "labels": ["important", "follow-up"]
}

Delete Email

Move email to trash or permanently delete.

Endpoint: DELETE /emails/:id

Query Parameters:

ParameterTypeDescriptionDefault
permanentbooleanPermanently delete (skip trash)false

Example Request:

curl -X DELETE https://api.pupam.com/v1/emails/email_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY"

Example Response:

{
  "id": "email_abc123",
  "status": "deleted",
  "message": "Email moved to trash"
}

Folders

List Folders

Endpoint: GET /folders

Example Response:

{
  "data": [
    {
      "id": "folder_inbox",
      "name": "Inbox",
      "type": "system",
      "email_count": 150,
      "unread_count": 12
    },
    {
      "id": "folder_xyz123",
      "name": "Customers",
      "type": "custom",
      "email_count": 45,
      "unread_count": 3
    }
  ]
}

Create Folder

Endpoint: POST /folders

Request Body:

{
  "name": "VIP Customers",
  "parent_id": null,
  "color": "#FF5733"
}

Automation

List Workflows

Endpoint: GET /workflows

Example Response:

{
  "data": [
    {
      "id": "workflow_abc123",
      "name": "Auto-assign Support Emails",
      "enabled": true,
      "trigger": {
        "type": "email_received",
        "conditions": [
          {
            "field": "subject",
            "operator": "contains",
            "value": "support"
          }
        ]
      },
      "actions": [
        {
          "type": "assign",
          "params": {
            "team": "support",
            "method": "round_robin"
          }
        }
      ]
    }
  ]
}

Create Workflow

Endpoint: POST /workflows

Request Body:

{
  "name": "VIP Customer Alert",
  "enabled": true,
  "trigger": {
    "type": "email_received",
    "conditions": [
      {
        "field": "from",
        "operator": "in_list",
        "value": "vip_customers"
      }
    ]
  },
  "actions": [
    {
      "type": "notify",
      "params": {
        "channel": "slack",
        "message": "VIP customer email received"
      }
    },
    {
      "type": "set_priority",
      "params": {
        "priority": "high"
      }
    }
  ]
}

Analytics

Get Email Stats

Endpoint: GET /analytics/emails

Query Parameters:

ParameterTypeDescription
periodstringday, week, month, year
start_datestringStart date (ISO 8601)
end_datestringEnd date (ISO 8601)

Example Response:

{
  "period": "week",
  "total_emails": 450,
  "emails_sent": 120,
  "emails_received": 330,
  "average_response_time": "2h 15m",
  "by_day": [
    {
      "date": "2025-10-18",
      "received": 45,
      "sent": 18
    }
  ]
}

Webhooks

Subscribe to real-time events.

Available Events

  • email.received
  • email.sent
  • email.opened
  • email.clicked
  • email.replied

Create Webhook

Endpoint: POST /webhooks

Request Body:

{
  "url": "https://your-app.com/webhooks/pupam",
  "events": ["email.received", "email.sent"],
  "secret": "your_webhook_secret"
}

Webhook Payload

{
  "event": "email.received",
  "timestamp": "2025-10-24T10:30:00Z",
  "data": {
    "email_id": "email_abc123",
    "from": "sender@example.com",
    "subject": "New Email"
  }
}

Error Codes

CodeDescription
200Success
201Created
400Bad Request
401Unauthorized
403Forbidden
404Not Found
429Rate Limit Exceeded
500Internal Server Error

Error Response Format:

{
  "error": {
    "code": "invalid_request",
    "message": "Missing required field: to",
    "details": {
      "field": "to",
      "reason": "required"
    }
  }
}

SDKs

Official SDKs available:

  • JavaScript/TypeScript: npm install @pupam/sdk
  • Python: pip install pupam
  • Ruby: gem install pupam
  • PHP: composer require pupam/sdk

JavaScript Example

import { Pupam } from '@pupam/sdk';

const client = new Pupam('YOUR_API_KEY');

// Send an email
await client.emails.send({
  to: [{ email: 'user@example.com' }],
  subject: 'Hello',
  body: { text: 'Hello World' }
});

// List emails
const emails = await client.emails.list({
  status: 'unread',
  limit: 10
});

Need help? Visit our support page or join our developer community.

Was this helpful?

Help us improve our documentation

Need more help?

Join our community or contact support

Contact Support
Đăng ký mua Tên miền, Tên miền, Cho thuê Hosting, Máy chủ, VPS, Email chuyên nghiệp, Chữ ký số Mắt Bão - CA