API v2 Documentation

All v2 endpoints use Bearer token authentication and return a standard response envelope.

Header required in all requests:

Authorization: Bearer <your_token>

Standard Response Envelope

All v2 endpoints wrap responses in a consistent envelope:

// Success (2xx)
{
  "data": { },
  "meta": { "requestId": "..." },
  "message": "Additional message" // Optional
}

// Error (4xx / 5xx)
{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable description",
    "details": { }
  },
  "meta": { "requestId": "..." }
}

User

User profile, permissions and wallet endpoints. Prefix: /api/v2/user

GET /api/v2/user/permissions

Returns the list of permissions assigned to the authenticated user.

Response:

{
  "data": {
    "permissions": ["acceso_srcm", "acceso_msmvl"]
  },
  "meta": { "requestId": "..." }
}
GET /api/v2/user/wallet

Returns wallet information (balance, currency) for the authenticated user.

Response:

{
  "data": {
    "balance": 50000,
    "currency": "EUR"
  },
  "meta": { "requestId": "..." }
}
GET /api/v2/user/wallet/history

Returns the wallet balance change history for the authenticated user.

Query params:

Name Type Description
limit number Items per page (default: 10)
offset number Offset for pagination, max 100 (default: 0)

Response:

{
  "data": [
    {
      "name": "John Doe",
      "amount": 1500,
      "type": "debit",
      "description": "Activación eSIM",
      "createdAt": "2026-03-11T10:00:00.000Z"
    }
  ],
  "meta": { "requestId": "..." }
}

SRCM

eSIM activation and management. Prefix: /api/v2/srcm/esim. Requires acceso_srcm permission.

POST /api/v2/srcm/esim

Activate an eSIM using customer data. Deducts the plan price from the user's wallet.

Body (JSON):

{
  "selected_plan": 14,
  "customer_name": "Juan",
  "customer_surname1": "Pérez",
  "customer_surname2": "García",
  "customer_document_type_id": 1,
  "customer_document_number": "12345678A",
  "customer_birthdate": "1990-05-15",
  "customer_sex": "H",
  "customer_nationality_id": 60
}

Body fields:

Field Type Description
selected_plan number Plan ID (required)
customer_name string Customer first name (required)
customer_surname1 string Customer first surname (required)
customer_surname2 string Customer second surname (optional, defaults to surname1)
customer_document_type_id number Document type ID (required)
customer_document_number string Document number (required)
customer_birthdate string Birth date in YYYY-MM-DD format (required)
customer_sex string "H" (male) or "M" (female) (required)
customer_nationality_id number Nationality ID (required)

Response:

{
  "data": {
    "iccid": "8934071234123456789",
    "phone": "123456789",
    "activationCode": "C0D123456789B123AC1234567F123E4E",
    "qrCode": "LPA:1$sm-...",
    "confirmationCode": "123456",
    "planName": "Prepago Travel M",
    "selectedPlan": 14,
    "amount": 15,
    "customer": {
      "name": "Juan",
      "surname1": "Pérez",
      "surname2": "García",
      "documentTypeId": 1,
      "documentNumber": "12345678A",
      "birthdate": "1990-05-15",
      "sex": "H",
      "nationalityId": 60
    }
  },
  "meta": { "requestId": "..." },
  "message": "eSIM activated successfully."
}

Possible errors:

Code HTTP Description
invalid_request 400 Body validation failed (Zod)
invalid_plan 400 Selected plan not found
INSUFFICIENT_BALANCE 400 Wallet balance too low
wallet_not_found 500 No wallet associated to user
wallet_update_failed 500 Failed to deduct from wallet
srcm_summary_failed 500 Failed to retrieve SAP summary
srcm_activation_failed 500 External SRCM API activation failed
srcm_activation_incomplete 500 Response missing required fields
srcm_api_error varies External SRCM API error
GET /api/v2/srcm/esim/form-data

Returns all form data needed for the eSIM activation form: countries, document types, plans and sexes. Replaces the three separate v1 endpoints.

Response:

{
  "data": {
    "countries": [
      { "value": 60, "name": "España" }
    ],
    "documentTypes": [
      { "value": 1, "name": "NIF" }
    ],
    "plans": [
      { "id": 14, "name": "Prepago Travel M", "price": 15 }
    ],
    "sexes": [
      { "value": 1, "name": "Hombre" }
    ]
  },
  "meta": { "requestId": "..." },
  "message": "Form data retrieved successfully."
}
GET /api/v2/srcm/esim/history

Returns paginated eSIM activation history for the authenticated user. Admins see an additional idClient field.

Query params:

Name Type Description
page number Page number, min 1 (default: 1)
limit number Items per page, 1–100 (default: 10)
dateFrom date Filter from date (optional, ISO format)
dateTo date Filter to date (optional, ISO format)

Response:

{
  "data": {
    "activationHistory": [
      {
        "iccid": "8934071234123456789",
        "phone": "123456789",
        "activationCode": "C0D123456789B123AC1234567F123E4E",
        "qrCode": "LPA:1$sm-...",
        "confirmationCode": "123456",
        "planName": "Prepago Travel M",
        "selectedPlan": 14,
        "amount": 15,
        "customerName": "Juan",
        "customerSurname1": "Pérez",
        "createdAt": "2026-03-11T10:00:00.000Z"
      }
    ],
    "total": 42
  },
  "meta": { "requestId": "..." },
  "message": "Activation history retrieved successfully."
}

MSMVL - Activation

SIM/eSIM activation via MSMVL. Prefix: /api/v2/msmvl/activation. Requires acceso_msmvl permission.

Compatibility note: for compatibility, the brand value "Lyca" also covers Llamaya. The API parameter must still be sent as "Lyca".

POST /api/v2/msmvl/activation

Activate a SIM or eSIM card. Performs the full flow: ICC validation (SIM only), document/age validation, activation with the telecom platform, wallet charge, recharge and bundle purchase when applicable.

If the external activation succeeds but a later step fails, the error response will include a details.step field indicating where the process stopped, and a details.partialData object with the data obtained so far. The client can then call the corresponding step endpoint to resume the process.

Body (JSON):

{
  "productId": "PO_Mali_M",
  "brand": "Lebara",
  "name": "Juan",
  "surname": "Pérez",
  "surname2": "García",
  "documentNumber": "12345678A",
  "dateOfBirth": "1990-05-15",
  "nationalityId": "ES",
  "iccId": "89340712341234567890",
  "simType": "sim",
  "identificationType": "personal-identity-code",
  "email": "user@example.com",
  "language": "eng"
}

Body fields:

Field Type Description
productId string Product/plan identifier (required)
brand "Lebara" | "Lyca" | "Orange" Brand (required). Use "Lyca" when referring to Llamaya.
name string Customer first name (required)
surname string Customer first surname (required)
surname2 string Customer second surname (optional)
documentNumber string Document number (required)
dateOfBirth string Date of birth (required)
nationalityId string Nationality code, 2 chars ISO (required)
iccId string ICC ID, 19–20 chars (required when simType is sim)
simType "sim" | "esim" SIM type (required)
identificationType "business-identity-code" | "nie" | "passport" | "personal-identity-code" Document type (required)
email string Customer email (required)
language string Contact language, 3 chars ISO 639-2/T (required, e.g. "eng")

Success response:

{
  "data": {
    "msisdnId": "612345678",
    "qrCode": "LPA:1$sm-...",
    "valueCharged": 5.00,
    "provisionId": "PROV-123456"
  },
  "message": "Activation completed successfully. The amount has been deducted from the wallet...",
  "meta": { "requestId": "..." }
}

Success data fields:

Field Type Description
msisdnId string Assigned phone number
qrCode string QR code for eSIM activation (present for eSIM)
valueCharged number Amount charged from wallet in EUR (only present when a charge was made)
provisionId string Bundle provision ID (only for non-Orange brands)

Error response (with step recovery):

{
  "error": {
    "code": "WALLET_UPDATE_FAILED",
    "message": "Failed to process the activation charge.",
    "details": {
      "step": "charge",
      "partialData": {
        "msisdnId": "612345678",
        "qrCode": "LPA:1$sm-..."
      }
    }
  },
  "meta": { "requestId": "..." }
}

When details.step is "charge", use the following endpoint to resume:

  • "charge"POST /api/v2/msmvl/activation/step/charge

If the error code is BUNDLE_FAILED (details.step: "bundle"), no automated recovery endpoint is available. Please contact support.


Possible errors:

Code HTTP Description
WALLET_NOT_FOUND 500 No wallet associated to user
ICC_ID_REQUIRED 400 iccId missing when simType is "sim"
ICC_ID_NOT_AVAILABLE 400 The provided ICC ID is not available for activation
BRAND_NOT_MAPPED 400 Brand could not be mapped to the configured recharge product
PRODUCT_NOT_FOUND 400 Requested product not found
ACTIVATION_COST_UNAVAILABLE 400 Could not determine the activation cost for the SIM
INSUFFICIENT_BALANCE 400 Wallet balance too low (a pending recharge is created)
WALLET_UPDATE_FAILED 500 Failed to deduct from wallet (step: charge)
RECHARGE_FAILED 500 External recharge failed (a pending recharge is created)
BUNDLE_FAILED 500 Bundle purchase failed (step: bundle)
PENDING_RECHARGE_SAVE_FAILED 500 Failed to save the pending recharge record
POST /api/v2/msmvl/activation/step/charge

Resume the activation process from the charge step (wallet charge + recharge + bundle purchase). Use this when the initial activation succeeded but a subsequent step failed (error response contained "details.step": "charge").

Body (JSON):

{
  "msisdnId": "612345678",
  "qrCode": "LPA:1$sm-...",
  "productId": "PO_Mali_M",
  "brand": "Lebara",
  "simType": "sim",
  "iccId": "89340712341234567890",
  "language": "eng"
}

Body fields:

Field Type Description
msisdnId string Phone number obtained from the activation (required)
qrCode string QR code obtained from the activation (required)
productId string Product/plan identifier (required)
brand "Lebara" | "Lyca" | "Orange" Brand (required)
simType "sim" | "esim" SIM type (required)
iccId string ICC ID, 19–20 chars (required when simType is sim)
language string Contact language, 3 chars ISO 639-2/T (required, e.g. "eng")

Success response:

{
  "data": {
    "msisdnId": "612345678",
    "qrCode": "LPA:1$sm-...",
    "valueCharged": 5.00,
    "provisionId": "PROV-123456"
  },
  "message": "Activation completed successfully. The amount has been deducted from the wallet...",
  "meta": { "requestId": "..." }
}

Possible errors:

Code HTTP Description
BAD_REQUEST 400 Body validation failed (Zod)
WALLET_NOT_FOUND 500 No wallet associated to user
BRAND_NOT_MAPPED 400 Brand could not be mapped to the configured recharge product
PRODUCT_NOT_FOUND 400 Requested product not found
ICC_ID_REQUIRED 400 iccId missing when simType is "sim"
ACTIVATION_COST_UNAVAILABLE 400 Could not determine the activation cost
INSUFFICIENT_BALANCE 400 Wallet balance too low (a pending recharge is created)
WALLET_UPDATE_FAILED 500 Failed to deduct from wallet
RECHARGE_FAILED 500 External recharge failed
BUNDLE_FAILED 500 Bundle purchase failed — contact support to resolve
GET /api/v2/msmvl/activation/facial/:iccId

Get the facial value (activation cost) for a given ICC ID. Used to determine how much balance the SIM already has before activation.

Path params:

Name Type Description
iccId string ICC ID, 19–20 chars (required)

Query params:

Name Type Description
brand "Lebara" | "Lyca" | "Orange" Brand name (required)
language string Language code, 2 chars ISO 639-1 (required)

Response:

{
  "data": {
    "value": 10.00
  },
  "meta": { "requestId": "..." }
}
GET /api/v2/msmvl/activation/history

Get MSMVL activation history for the authenticated user.

Query params:

Name Type Description
page number Page number, min 1 (default: 1)
limit number Items per page, 1–100 (default: 10)
dateFrom date Filter from date (optional, ISO format)
dateTo date Filter to date (optional, ISO format)

Response:

{
  "data": {
    "activationHistory": [
      {
        "id": 1,
        "msisdnId": "612345678",
        "qrCode": "LPA:1$sm-...",
        "createdAt": "2026-03-11T10:00:00.000Z"
      }
    ],
    "total": 42
  },
  "message": "Activation history retrieved successfully.",
  "meta": { "requestId": "..." }
}
GET /api/v2/msmvl/activation/recharge-pending

Get pending recharges for incomplete MSMVL activations (created when the user had insufficient wallet balance at activation time or when the Ya Ganaste recharge failed).

Query params:

Name Type Description
limit number Items to return (optional)
offset number Offset for pagination, max 100 (optional)

Response:

{
  "data": [...],
  "message": "Pending activation recharges retrieved successfully.",
  "meta": { "requestId": "..." }
}

Possible errors:

Code HTTP Description
PENDING_RECHARGES_RETRIEVE_FAILED 500 Failed to retrieve pending recharges
POST /api/v2/msmvl/activation/recharge-pending

Complete a pending activation recharge. Performs the external recharge and bundle purchase when needed to finish an activation that was left pending. The pending recharge record is deleted upon success.

Body (JSON):

{
  "mobileNumber": "612345678"
}

Body fields:

Field Type Description
mobileNumber string Mobile number, 9 digits (required)

Success response:

{
  "data": {
    "msisdnId": "612345678",
    "amount": 500
  },
  "message": "Recarga realizada correctamente para completar el proceso de activación.",
  "meta": { "requestId": "..." }
}

Success data fields:

Field Type Description
msisdnId string The mobile number
amount number Amount recharged (in cents)

Possible errors:

Code HTTP Description
PENDING_RECHARGE_NOT_FOUND 404 No pending recharge found for this mobile number
PENDING_RECHARGE_RETRIEVE_FAILED 500 Failed to retrieve the pending recharge
PRODUCT_NOT_FOUND 500 Product associated to the pending recharge not found
ACTIVATION_REFERENCE_NOT_FOUND 500 Activation reference not found for this mobile number
ACTIVATION_REFERENCE_RETRIEVE_FAILED 500 Failed to retrieve the activation reference
BUNDLE_CASH_FAILED 500 Failed to apply BundleCash in Masmovil Services (eSIM)
FACIAL_VALUE_RETRIEVE_FAILED 500 Failed to retrieve the facial value for the physical SIM
ICCID_NOT_FOUND 500 ICCID not found for physical SIM recharge
RECHARGE_FAILED 500 External recharge (Topup) failed
BUNDLE_FAILED 500 Bundle purchase failed after recharge

MSMVL – Validation

Validation utilities. Prefix: /api/v2/msmvl/validate. Requires acceso_msmvl permission.

GET /api/v2/msmvl/validate/:iccid

Validate if an ICC ID (SIM card identifier) is available for activation.

Query params:

Name Type Description
brand "Lebara" | "Lyca" | "Orange" Brand (required)
GET /api/v2/msmvl/validate/age

Validate minimum age requirement (must be at least 18 years old).

Query params:

Name Type Description
dateOfBirth string Date of birth in YYYY-MM-DD format (required)
GET /api/v2/msmvl/validate/document

Validate an identification document number.

Query params:

Name Type Description
documentNumber string Document number (required)
identificationType "business-identity-code" | "nie" | "passport" | "personal-identity-code" Document type (required)

MSMVL – Products

Product catalog. Prefix: /api/v2/msmvl/products. Requires acceso_msmvl permission.

GET /api/v2/msmvl/products

Get the list of available products for a brand.

Query params:

Name Type Description
brand "Lebara" | "Lyca" | "Orange" Brand (required). Use "Lyca" when referring to Llamaya.
language "en" | "es" Language for product names (optional. 'es' by default)

MSMVL – MSISDN Operations

Phone number management. Prefix: /api/v2/msmvl/msisdn-op. Requires acceso_msmvl permission.

GET /api/v2/msmvl/msisdn-op/operator/:msisdn

Get the operator info for a phone number (current operator, origin, portability status).

GET /api/v2/msmvl/msisdn-op/balance/:msisdn

Get balance for a phone number.

Query params:

Name Type Description
brand "Lebara" | "Lyca" | "Orange" Brand (required)
GET /api/v2/msmvl/msisdn-op/msisdn/:msisdn

Get comprehensive MSISDN info (ICC ID, IMSI, PINs, PUKs, status, product, balance, bonuses, QR code).

Query params:

Name Type Description
brand "Lebara" | "Lyca" | "Orange" Brand (required)
GET /api/v2/msmvl/msisdn-op/msisdn/:mobileNumber/services

Get active services for a phone number.

Query params:

Name Type Description
brand "Lebara" | "Lyca" | "Orange" Brand (required)
GET /api/v2/msmvl/msisdn-op/msisdn/:mobileNumber/esimQr

Get eSIM activation QR info (URL and request date) for a phone number.

Query params:

Name Type Description
brand "Lebara" | "Lyca" | "Orange" Brand (required)

MSMVL – Inventory

Inventory lookup. Prefix: /api/v2/msmvl/inventory. Requires acceso_msmvl permission.

GET /api/v2/msmvl/inventory/:mobileNumber

Get inventory info (ID and brand) for a mobile number.

Path params:

Name Type Description
mobileNumber string Mobile number, exactly 9 digits (required)

Response:

{
  "data": {
    "id": "INV_12345",
    "brand": "Lebara"
  },
  "meta": { "requestId": "..." }
}