Email subscription to a list
Public endpoint, configurable fields, single/double opt-in, and unsubscribe.
Email subscription to a list
Eligible lists: type = manual and public_subscription_enabled = true. No session or API key is required.
Endpoints
| Method | Path | Use |
|---|---|---|
GET | /api/public/organizations/{slug}/subscription-lists | Public lists, confirmation policy, and configured fields. |
POST | /api/public/organizations/{slug}/subscriptions | Applies single opt-in or requests double opt-in. |
GET / POST | /api/subscribe/confirm | Inspects and consumes the email token. |
GET / POST | /api/unsubscribe | Unsubscribes using its token. |
Fetch a list form
Fetch the organization's public lists before rendering a form:
curl 'https://crm.lacrypta.ar/api/public/organizations/la-crypta/subscription-lists'{
"lists": [
{
"id": "<list-id>",
"name": "Newsletter",
"description": "La Crypta news",
"color": "#3b82f6",
"language_preference": "en",
"confirmation_required": true,
"fields": [
{ "key": "company", "label": "Company", "required": true },
{ "key": "city", "label": "City", "required": false }
]
}
]
}The endpoint needs no authentication and returns only manual lists with public subscription enabled. Each fields item defines a text input:
| Property | Use |
|---|---|
key | Stable key sent in the subscription fields object. |
label | Text displayed to the person. |
required | When true, the form must require a value for that list. |
When multiple lists are selected, merge their fields by key: a key is required when any selected list returns required: true. Send the values under those same keys in POST /subscriptions.
Request
curl --request POST 'https://crm.lacrypta.ar/api/public/organizations/la-crypta/subscriptions' \
--header 'Content-Type: application/json' \
--data '{
"email": "satoshi@example.com",
"name": "Satoshi",
"list_ids": ["<list-id>"],
"fields": { "company": "Acme", "city": "Buenos Aires" }
}'email is required. name, list_ids, and fields are optional. A key is valid when at least one selected list defines it and required when any selected list marks it required. Unknown keys, non-string values, and values longer than 2000 characters return 400. Without lists, fields must be empty.
| Status | Meaning |
|---|---|
400 | Invalid JSON, email, list, or fields. |
404 | Missing or inactive organization. |
200 | Single opt-in processed: { "status": "subscribed" }. |
202 | Accepted request: { "status": "confirmation_required" }. It does not mean an active subscription. |
Confirmation
If any selected list requires confirmation, all changes are held behind one token. Contact, consent, memberships, and fields are created only after it is consumed. Values live under organization_contacts.custom_fields.subscription; only submitted keys are overwritten.
If no list requires confirmation, the request is applied atomically as public_single_opt_in. When at least one list enables welcome mail, at most one message is sent after enrollment; delivery failure does not roll consent back.
Consuming a double-opt-in token:
- creates or links the user by email;
- creates the organization contact;
- creates the email subscription with
consent_source = public_double_opt_in; - adds memberships only to lists that are still public;
- invalidates the token.
An unsubscribe requires a new request and follows the lists' current policy. Responses do not reveal whether an identity already existed or was throttled.
Full contract: API reference.