critical
Creates, reads, extends and deletes address and domain lists — suppression lists, for example — with requests, without editing files.
Paths. GET /config/address-lists — the names of all lists; GET, POST, PUT, PATCH and DELETE on /config/address-lists/name — read, create, replace, extend and delete a list; DELETE on …/addresses/address, …/hashed-addresses/address and …/domains/domain — remove one entry. Request bodies and responses are JSON.
Enable it first: the endpoint works only with http-enable-api-config yes, which is off by default.
Objects created this way can only be edited through the API: they are not in the configuration file, and the two ways of describing the same thing do not reconcile. The engine stores them in /var/lib/pmta/config-api.
Reading goes through without a key from an address with the operator level or higher in http-access; any change requires the key from http-api-key in the X-API-Key header.
What each method does:
| Method | Path | Action |
|---|---|---|
| GET | /config/address-lists | the names of all lists |
| GET | …/name | the list contents |
| POST | …/name | create; an error if the list exists |
| PUT | …/name | replace entirely; an error if the list does not exist |
| PATCH | …/name | extend; duplicates are silently skipped |
| DELETE | …/name or …/name/addresses/address | delete a list or one entry |
# add two addresses to a suppression list curl -s -X PATCH 'http://127.0.0.1:8080/config/address-lists/suppress' -H 'X-API-Key: KEY' -H 'Content-Type: application/json' -d '{"addresses":["a@example.com","b@example.com"]}'
3 relations
Configuration through the API and the file do not reconcileThe mechanism that is visible here. § 8.3
Compute a hashThe same output from the command line. inference
Address lists — named and unnamedThe mechanism that is visible here. § 8.3.2
grep -n 'http-enable-api-config' /etc/pmta/config curl -s 'http://127.0.0.1:8080/config/address-lists' ls /var/lib/pmta/config-api/
3 articles
◇Address lists — named and unnamedA list of addresses, domains, patterns or hashes; a named one is attached by directives such as suppression, an unnamed one lives inside an inbound mail processor.◇Configuration through the API and the file do not reconcileObjects created through the configuration interface cannot be edited in the file: two sources of truth about the configuration do not reconcile.◇Two attachment points — and two different behaviorsA list attached to a source rejects the recipient at submission or bounces the message later; attached to a sending address or pool, it always accepts and then bounces.