REST API

The Sublogin API add-on (MageB2B_SubloginApi) exposes Sublogin CRUD endpoints via Magento Web API (REST/SOAP) for integration with ERP, CRM, or automation scripts.

Base URL

https://yourstore.com/rest/V1/sublogin

Endpoints

1. Get Sublogin by ID

GET /V1/sublogin/:idACL: MageB2B_Sublogin::manage

2. Search Sublogins

GET /V1/sublogin/searchACL: MageB2B_Sublogin::manage Uses standard Magento searchCriteria.

3. Create Sublogin

POST /V1/subloginACL: MageB2B_Sublogin::save

4. Update Sublogin

PUT /V1/sublogin/:idACL: MageB2B_Sublogin::save

5. Delete Sublogin

DELETE /V1/sublogin/:idACL: MageB2B_Sublogin::delete

Field Reference: Sublogin

FieldTypeRequiredDescription
idintNo (auto)Primary key of the sublogin
entity_idintYesMagento Customer Entity ID (FK to customer_entity.entity_id)
customer_idstringNoExternal customer number (e.g., ERP number)
emailstringYesLogin email address (must be unique)
optional_emailstringNoAlternative email for notifications
passwordstringYes (POST)Password (stored hashed)
firstnamestringYesFirst name
lastnamestringYesLast name
prefixstringNoPrefix (e.g., "Mr.", "Ms.", "Dr.")
expire_datestringNoAccount expiration date (YYYY-MM-DD), null = no expiration
activeboolNotrue = active, false = disabled
send_backendmailsboolNoReceives copies of backend emails (order confirmations, etc.)
store_idintNoStore View ID
create_subloginsboolNoPermission to create further sublogins
is_subscribedboolNoNewsletter subscription
last_login_atstringNo (auto)Last login timestamp
default_billingintNoID of the default billing address
default_shippingintNoID of the default shipping address
customer_address_idsstring[]NoIDs of allowed customer addresses (from parent customer)
addressesAddress[]NoCustom sublogin addresses

Field Reference: Address

FieldTypeRequiredDescription
idintNo (auto)Primary key
prefixstringNoPrefix
firstnamestringYesFirst name
lastnamestringYesLast name
companystringNoCompany name
streetstring[]YesStreet and house number (Array for multi-line)
citystringYesCity
country_idstringYesCountry code (ISO 3166-1 alpha-2)
postcodestringYesPostcode
telephonestringYesTelephone number
default_billingboolNoSet as default billing address
default_shippingboolNoSet as default shipping address

ID Logic

  • id: Primary key of the sublogin record.
  • entity_id: Magento Customer Entity ID (parent customer).
  • customer_id: External ID (e.g., "K-2024-00123" from ERP).

Address Concept

Sublogins can use two types of addresses:

  1. Customer Addresses: Referenced by IDs from the parent customer.
  2. Custom Addresses: Independent addresses specific to the sublogin.

Examples

Create Sublogin with Custom Address

curl -X POST "https://yourstore.com/rest/V1/sublogin" \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "sublogin": { "entity_id": 123, "email": "purchasing@company.com", "password": "Secure123!", "firstname": "John", "lastname": "Doe", "active": true, "addresses": [ { "firstname": "John", "lastname": "Doe", "company": "Company Ltd - Purchasing", "street": ["Industrial St 10"], "city": "Hamburg", "country_id": "DE", "postcode": "20095", "telephone": "+49 40 987654", "default_billing": true, "default_shipping": true } ] } }'

Search Sublogins for a Customer

curl -X GET "https://yourstore.com/rest/V1/sublogin/search?searchCriteria[filterGroups][0][filters][0][field]=entity_id&searchCriteria[filterGroups][0][filters][0][value]=123" \ -H "Authorization: Bearer "

Found an issue with this documentation? Let us know