Labels & Addresses
Labels
Label (category/folder) management via /core/v4/labels.
Operations
// Fetch labels filtered by type(s)
labels, err := c.GetLabels(ctx, proton.LabelLabel, proton.LabelFolder)
// Find a specific label by ID
label, err := c.GetLabel(ctx, labelID, proton.LabelLabel)
// Create a label
label, err := c.CreateLabel(ctx, proton.CreateLabelReq{
Name: "Personal",
Color: "#ff0000",
Type: proton.LabelLabel,
Parent: parentID,
})
// Update a label
err := c.UpdateLabel(ctx, labelID, proton.UpdateLabelReq{
Name: "Updated Name",
Color: "#00ff00",
})
// Delete a label
err := c.DeleteLabel(ctx, labelID)
System Label Constants
| Constant | ID | Description |
|---|---|---|
InboxLabel |
"0" | Inbox |
AllSentLabel |
"2" | All Sent |
TrashLabel |
"3" | Trash |
SpamLabel |
"4" | Spam |
AllMailLabel |
"5" | All Mail |
StarredLabel |
"10" | Starred |
Email Addresses
Email address management via /core/v4/addresses.
Operations
// List addresses (sorted by order)
addresses, err := c.GetAddresses(ctx)
// Get a single address
addr, err := c.GetAddress(ctx, addressID)
// Reorder addresses
err := c.OrderAddresses(ctx, proton.OrderAddressesReq{...})
// Enable/disable address
err := c.EnableAddress(ctx, addressID)
err := c.DisableAddress(ctx, addressID)
// Delete address
err := c.DeleteAddress(ctx, addressID)
Address Types
| Type | Description |
|---|---|
Original |
Original Proton address |
Alias |
Proton alias |
Custom |
Custom domain address |
Premium |
Premium address |
External |
Bring Your Own Email (BYOE) |
BYOE Detection
if addr.IsBYOEAddress() {
// External type with sending enabled
}
Key Types
| Type | Description |
|---|---|
Label |
ID, parentID, name, path ([]string), color, type |
LabelType |
Label, ContactGroup, Folder, System |
Address |
ID, email, send/receive flags, status, type, order, display name, keys |
AddressStatus |
Disabled, enabled, deleting |
AddressType |
Original, alias, custom, premium, external |
Path Handling
The API sends label path as a string (e.g., "Inbox/SubFolder"), which is split into a []string slice for Go use, with custom MarshalJSON/UnmarshalJSON.
No comments to display
No comments to display