Skip to content
LA CRYPTADOCS / 01

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

MethodPathUse
GET/api/public/organizations/{slug}/subscription-listsPublic lists, confirmation policy, and configured fields.
POST/api/public/organizations/{slug}/subscriptionsApplies single opt-in or requests double opt-in.
GET / POST/api/subscribe/confirmInspects and consumes the email token.
GET / POST/api/unsubscribeUnsubscribes 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:

PropertyUse
keyStable key sent in the subscription fields object.
labelText displayed to the person.
requiredWhen 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.

StatusMeaning
400Invalid JSON, email, list, or fields.
404Missing or inactive organization.
200Single opt-in processed: { "status": "subscribed" }.
202Accepted 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:

  1. creates or links the user by email;
  2. creates the organization contact;
  3. creates the email subscription with consent_source = public_double_opt_in;
  4. adds memberships only to lists that are still public;
  5. 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.