> For the complete documentation index, see [llms.txt](https://docs.mailtrap.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mailtrap.io/developers/email-marketing/email-campaigns/get-a-list-of-email-campaigns.md).

# Get a list of email campaigns

Returns a paginated list of the account's email campaigns, newest first.

Pagination is page-token based. Use the `token` query parameter together with the `token`, `next_token`, and `prev_token` values returned in the `pagination` object to navigate between pages.

```json
{"openapi":"3.1.0","info":{"title":"Email Campaigns","version":"2.0.0"},"tags":[{"name":"Email Campaigns","description":"Manage email campaigns"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"Pass the API token in the Api-Token header","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","description":"Pass the API token as a Bearer token in the Authorization header","scheme":"bearer"}},"parameters":{"token":{"name":"token","description":"Page number to retrieve (page-token pagination). Defaults to `1`.","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1}},"per_page":{"name":"per_page","description":"Number of campaigns per page. Defaults to `50`, maximum `100`.","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},"search":{"name":"search","description":"Filter campaigns by name (case-insensitive partial match).","in":"query","required":false,"schema":{"type":"string"}}},"responses":{"EmailCampaignsResponse":{"description":"A paginated list of email campaigns.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EmailCampaign"}},"pagination":{"$ref":"#/components/schemas/Pagination"}}}}}},"UNAUTHENTICATED":{"description":"Authentication failed — missing or invalid API token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"PERMISSION_DENIED":{"description":"The API token does not have permission to access this resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionDeniedResponse"}}}},"RATE_LIMITED":{"description":"Too many requests. The public API is rate limited to 150 requests per 10 seconds per\nAPI token. Retry after the window resets (see the `x-ratelimit-reset` header).","headers":{},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitedResponse"}}}}},"schemas":{"EmailCampaign":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"domain_id":{"type":"integer","format":"int64","description":"ID of the sending domain used for the campaign, as returned by the Sending Domains endpoints."},"domain_name":{"type":"string"},"name":{"type":"string"},"from_local_part":{"type":"string"},"from_display_name":{"type":"string"},"reply_to":{"$ref":"#/components/schemas/ReplyTo"},"current_state":{"type":"string","description":"Current state of the campaign in its lifecycle.","enum":["draft","scheduled","started","queued","paused","terminating","under_review","finished","failed","failed_immediately"]},"current_state_metadata":{"type":"object","description":"Metadata about the most recent state transition. Which keys are present depends on the state.","properties":{"reason":{"type":"string"},"error":{"type":"string","description":"Last error message recorded for a failed campaign."},"errors":{"type":"array","description":"Per-recipient errors recorded when sending failed.","items":{"type":"object","properties":{"message":{"type":"string"},"rcpt_index":{"type":"integer"}}}},"scheduled_at":{"type":"string","format":"date-time","description":"When the campaign is scheduled to send (ISO 8601). Present in the `scheduled` state."}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"last_started_at":{"type":["string","null"],"format":"date-time"},"last_started_at_date":{"type":"string","format":"date","description":"Date the campaign was last started. Present only when the campaign has been started."},"recipient_total_count":{"type":["integer","null"],"description":"Total number of recipients targeted by the campaign. `null` until the audience is resolved."},"contact_list_ids":{"type":"array","description":"IDs of the contact lists included in the campaign's audience.","items":{"type":"integer","format":"int64"}},"contact_segment_ids":{"type":"array","description":"IDs of the contact segments included in the campaign's audience.","items":{"type":"integer","format":"int64"}},"delivery_mode":{"type":"string","description":"How the campaign is delivered. `rapid` sends as fast as possible; `gradual` throttles\nsending to `delivery_options.emails_per_hour`.","enum":["rapid","gradual"]},"delivery_options":{"type":"object","description":"Delivery throttling options. Applies when `delivery_mode` is `gradual`.","properties":{"emails_per_hour":{"type":["integer","null"]}}},"template":{"type":"object","description":"The campaign's template. `body_html` and `body_text` are returned only on\nsingle-campaign responses (create, update, get-by-ID); the list endpoint omits them to\nkeep the payload small.","properties":{"id":{"type":"integer","format":"int64"},"subject":{"type":"string"},"merge_tags":{"type":"array","items":{"type":"string"}},"body_html":{"type":["string","null"],"description":"HTML body (the design). Returned only on single-campaign responses."},"body_text":{"type":["string","null"],"description":"Plain-text body. Returned only on single-campaign responses."}}}}},"ReplyTo":{"type":"object","description":"Reply-To address parts.","properties":{"display_name":{"type":"string"},"local_part":{"type":"string"},"domain":{"type":"string"}}},"Pagination":{"type":"object","description":"Page-token pagination metadata.","properties":{"token":{"type":"integer","description":"Current page number."},"prev_token":{"type":["integer","null"],"description":"Previous page number, or `null` on the first page."},"next_token":{"type":["integer","null"],"description":"Next page number, or `null` on the last page."},"first_url":{"type":"string","format":"uri"},"prev_url":{"type":["string","null"],"format":"uri"},"current_url":{"type":"string","format":"uri"},"next_url":{"type":["string","null"],"format":"uri"}}},"UnauthenticatedResponse":{"type":"object","properties":{"error":{"type":"string"}}},"PermissionDeniedResponse":{"type":"object","properties":{"errors":{"type":"string"}}},"RateLimitedResponse":{"type":"object","properties":{"error":{"type":"string"}}}}},"paths":{"/api/email_campaigns":{"get":{"operationId":"getEmailCampaigns","summary":"Get a list of email campaigns","description":"Returns a paginated list of the account's email campaigns, newest first.\n\nPagination is page-token based. Use the `token` query parameter together with the\n`token`, `next_token`, and `prev_token` values returned in the `pagination` object to\nnavigate between pages.","tags":["Email Campaigns"],"parameters":[{"$ref":"#/components/parameters/token"},{"$ref":"#/components/parameters/per_page"},{"$ref":"#/components/parameters/search"}],"responses":{"200":{"$ref":"#/components/responses/EmailCampaignsResponse"},"401":{"$ref":"#/components/responses/UNAUTHENTICATED"},"403":{"$ref":"#/components/responses/PERMISSION_DENIED"},"429":{"$ref":"#/components/responses/RATE_LIMITED"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mailtrap.io/developers/email-marketing/email-campaigns/get-a-list-of-email-campaigns.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
