Organizaciones

CRUD de organizaciones (tenants). El multi-tenancy de Mosend se construye sobre este modelo.

Base path: /organizations·10 endpoints·Source: mosend-wb-backend/src/modules/organizations/organizations.controller.ts
GET/organizations
bearer

Listar organizaciones del usuario actual

Respuestas

  • 200
curl -X GET 'https://api.mosend.dev/organizations' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>'
Response · 200
{
  "data": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "createdAt": "2026-05-01T03:42:18.123Z"
    }
  ],
  "timestamp": "2026-05-01T03:42:18.123Z"
}
POST/organizations
bearer

Crear organización (queda como owner)

Body (JSON)

  • namestringrequerido
  • slugstringrequerido
  • billingEmailstring · emailrequerido
  • countrystring
  • currencystring
  • timezonestring
  • planSlugstring
  • billingParentIdstring · uuid

Respuestas

  • 201
curl -X POST 'https://api.mosend.dev/organizations' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>' \
  -H 'Content-Type: application/json' \
  -d '{"name": "<name>","slug": "<slug>","billingEmail": "persona@empresa.com","country": "<country>","currency": "<currency>","timezone": "<timezone>","planSlug": "<planSlug>","billingParentId": "00000000-0000-0000-0000-000000000000"}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "Mi Empresa",
    "slug": "mi-empresa"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/quota
bearer

Estado de cupo del usuario para crear organizaciones

Respuestas

  • 200
curl -X GET 'https://api.mosend.dev/organizations/quota' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/slug-suggest
bearer

Sugiere un slug disponible para un nombre dado

Query params

  • namestringrequerido

Respuestas

  • 200
curl -X GET 'https://api.mosend.dev/organizations/slug-suggest' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>'
Response · 200
{
  "data": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "createdAt": "2026-05-01T03:42:18.123Z"
    }
  ],
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/slug-available
bearer

Verifica si un slug está disponible

Query params

  • slugstringrequerido

Respuestas

  • 200
curl -X GET 'https://api.mosend.dev/organizations/slug-available' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>'
Response · 200
{
  "data": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "createdAt": "2026-05-01T03:42:18.123Z"
    }
  ],
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/:id
bearer

Obtener organización por id

Path params

  • idstringrequerido

Respuestas

  • 200
curl -X GET 'https://api.mosend.dev/organizations/00000000-0000-0000-0000-000000000000' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
PATCH/organizations/:id
bearer

Actualizar organización (requiere organizations:write)

Path params

  • idstringrequerido

Body (JSON)

  • namestring
  • billingEmailstring · email
  • countrystring
  • currencystring
  • timezonestring
  • businessHoursScheduleobject
  • optOutEnabledboolean
  • optOutKeywordsstring[]

Respuestas

  • 200
curl -X PATCH 'https://api.mosend.dev/organizations/00000000-0000-0000-0000-000000000000' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>' \
  -H 'Content-Type: application/json' \
  -d '{"name": "<name>","billingEmail": "persona@empresa.com","country": "<country>","currency": "<currency>","timezone": "<timezone>","businessHoursSchedule": {},"optOutEnabled": true,"optOutKeywords": []}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "Mi Empresa",
    "slug": "mi-empresa"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
GET/organizations/:orgId/billing-group
bearer

Estado del grupo de facturación de la organización

Path params

  • orgIdstringrequerido

Respuestas

  • 200
curl -X GET 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/billing-group' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
POST/organizations/:orgId/billing-group/link
bearer

Compartir facturación: enlazar la org como hija de una matriz (solo owner)

Path params

  • orgIdstringrequerido

Body (JSON)

  • parentOrgIdstring · uuidrequerido

Respuestas

  • 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/billing-group/link' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>' \
  -H 'Content-Type: application/json' \
  -d '{"parentOrgId": "00000000-0000-0000-0000-000000000000"}'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}
POST/organizations/:orgId/billing-group/unlink
bearer

Independizar: desenlazar la org de su matriz, pasa a plan free (solo owner)

Path params

  • orgIdstringrequerido

Respuestas

  • 201
curl -X POST 'https://api.mosend.dev/organizations/a1b2c3d4-1234-5678-9abc-def012345678/billing-group/unlink' \
  -H 'X-Api-Key: mk_live_<prefix>.<secret>'
Response · 200
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2026-05-01T03:42:18.123Z"
  },
  "timestamp": "2026-05-01T03:42:18.123Z"
}