> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.freecustom.email/free-custom-email-api/v-1/inboxes/inbox/messages/list-messages/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.freecustom.email/_mcp/server. # List messages GET https://api2.freecustom.email/v1/inboxes/{inbox}/messages Returns a paginated list of messages received in the specified inbox, ordered newest first. **Path parameters:** - `:inbox` — URL-encoded inbox address (e.g., `test%40domain.com`) **Query parameters:** - `limit` *(optional)* — Number of messages to return per page. Default: `20`. Max: `100`. - `before` *(optional)* — Cursor for pagination. Pass the `id` of the last message from the previous page to fetch the next page. **Response fields (per message):** - `id` — Unique message identifier - `from` — Sender address - `subject` — Email subject line - `receivedAt` — ISO 8601 timestamp - `otp` — `"__DETECTED__"` if an OTP was found but plan is below Growth; full value on Growth+ **Behaviour:** - Returns an empty array `[]` if no messages have been received. - Use the `before` cursor with the last `id` in the response to paginate through older messages. **Plan:** All plans (Free and above). Full OTP value in listing requires Growth plan or higher. Reference: https://docs.freecustom.email/free-custom-email-api/v-1/inboxes/inbox/messages/list-messages ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Path parameters - `inbox` (string, required) ### Query parameters - `limit` (integer, optional) - `before` (string, optional) — Message ID — returns messages older than this ## Response ### 200 OK - `success` (boolean, required) - `data` (V1InboxesInboxMessagesGetResponsesContentApplicationJsonSchemaData, required) ## Errors ### 401 Unauthorized Error Unauthorized - `success` (boolean, required) - `error` (string, required) - `message` (string, required) ### 403 Forbidden Error Forbidden - `success` (boolean, required) - `error` (string, required) - `message` (string, required) ### 429 Too Many Requests Error Too Many Requests - `success` (boolean, required) - `error` (string, required) - `message` (string, required) - `upgrade_url` (string, required) - `credits_url` (string, required) - `hint` (string, required) ## Types ### V1InboxesInboxMessagesGetResponsesContentApplicationJsonSchemaData - `inbox` (string, required) - `messages` (list of V1InboxesInboxMessagesGetResponsesContentApplicationJsonSchemaDataMessagesItems, required) - `count` (integer, required) - `has_more` (boolean, required) ### V1InboxesInboxMessagesGetResponsesContentApplicationJsonSchemaDataMessagesItems - `id` (string, required) - `from` (string, required) - `subject` (string, required) - `date` (datetime, required) - `has_attachment` (boolean, required) - `otp` (string, required) - `verification_link` (string, required) ## Examples **Response** ```json { "success": true, "data": { "inbox": "string", "messages": [ { "id": "string", "from": "string", "subject": "string", "date": "2025-01-04T10:08:40.720Z", "has_attachment": false, "otp": "string", "verification_link": "string" }, { "id": "string", "from": "string", "subject": "string", "date": "1955-01-15T16:03:05.610Z", "has_attachment": false, "otp": "string", "verification_link": "string" } ], "count": 3338, "has_more": false } } ``` **SDK Code** ```python v1_inboxes_{inbox}_messages_List messages_example import requests url = "https://api2.freecustom.email/v1/inboxes/%7B%7Bmailbox%7D%7D/messages" querystring = {"limit":"20","before":"string"} headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers, params=querystring) print(response.json()) ``` ```javascript v1_inboxes_{inbox}_messages_List messages_example const url = 'https://api2.freecustom.email/v1/inboxes/%7B%7Bmailbox%7D%7D/messages?limit=20&before=string'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go v1_inboxes_{inbox}_messages_List messages_example package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api2.freecustom.email/v1/inboxes/%7B%7Bmailbox%7D%7D/messages?limit=20&before=string" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby v1_inboxes_{inbox}_messages_List messages_example require 'uri' require 'net/http' url = URI("https://api2.freecustom.email/v1/inboxes/%7B%7Bmailbox%7D%7D/messages?limit=20&before=string") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` ```java v1_inboxes_{inbox}_messages_List messages_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api2.freecustom.email/v1/inboxes/%7B%7Bmailbox%7D%7D/messages?limit=20&before=string") .header("Authorization", "Bearer ") .asString(); ``` ```php v1_inboxes_{inbox}_messages_List messages_example request('GET', 'https://api2.freecustom.email/v1/inboxes/%7B%7Bmailbox%7D%7D/messages?limit=20&before=string', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp v1_inboxes_{inbox}_messages_List messages_example using RestSharp; var client = new RestClient("https://api2.freecustom.email/v1/inboxes/%7B%7Bmailbox%7D%7D/messages?limit=20&before=string"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift v1_inboxes_{inbox}_messages_List messages_example import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api2.freecustom.email/v1/inboxes/%7B%7Bmailbox%7D%7D/messages?limit=20&before=string")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```