Get Portal by Mailbox
Retrieves the portal configuration associated with a specific ECGrid mailbox.
Endpoint
GET /v2/portals/by-mailbox/{mailboxId}
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
mailboxId | int | Yes | The ID of the mailbox whose portal configuration should be retrieved |
Response
Returns the portal record linked to the specified mailbox, including the portal URL and current status.
{
"success": true,
"data": {
"portalId": 501,
"mailboxId": 7890,
"url": "https://portal.ecgrid.io/company-name",
"status": "Active",
"created": "2024-09-01T12:00:00Z"
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
portalId | int | Unique identifier for the portal record |
mailboxId | int | The mailbox this portal is associated with |
url | string | The public-facing URL for the customer portal |
status | string | Current status of the portal (e.g., Active, Suspended) |
created | datetime | UTC timestamp when the portal was created |
Code Examples
- cURL
- C#
- Java
- Node.js
- Python
curl -X GET "https://rest.ecgrid.io/v2/portals/by-mailbox/$MAILBOX_ID" \
-H "X-API-Key: $ECGRID_API_KEY"
// .NET 10 — Retrieve the portal configuration for a given mailbox
using System.Net.Http.Json;
int mailboxId = 7890;
var response = await httpClient.GetAsync(
$"https://rest.ecgrid.io/v2/portals/by-mailbox/{mailboxId}");
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadFromJsonAsync<ApiResponse<PortalInfo>>();
Console.WriteLine($"Portal URL: {result?.Data?.Url}");
Console.WriteLine($"Status: {result?.Data?.Status}");
import java.net.URI;
import java.net.http.*;
String apiKey = System.getenv("ECGRID_API_KEY");
String mailboxId = "0"; // replace with actual mailboxId
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(String.format("https://rest.ecgrid.io/v2/portals/by-mailbox/%s", mailboxId)))
.header("X-API-Key", apiKey)
.GET()
.build();
HttpClient client = HttpClient.newHttpClient();
HttpResponse<String> response = client.send(
request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
const apiKey = process.env.ECGRID_API_KEY;
const url = `https://rest.ecgrid.io/v2/portals/by-mailbox/${mailboxId}`;
const response = await fetch(url, {
method: 'GET',
headers: { 'X-API-Key': apiKey },
});
const data = await response.json();
console.log(data);
import os, requests
api_key = os.environ["ECGRID_API_KEY"]
headers = {"X-API-Key": api_key}
mailbox_id = 0 # replace with actual mailbox_id
url = f"https://rest.ecgrid.io/v2/portals/by-mailbox/{mailbox_id}"
response = requests.get(url, headers=headers)
response.raise_for_status()
print(response.json())