Skip to content

Creating Accounts

Unmanagable Accounts

Within MyPup the accounts are "shared" accross all the tenants. This means that the e-mail addresses are globally unique. Only accounts that are linked to a PickUpPoint that you (the tenant) can manage can be managed (looked up and/or changed). All other accounts cannot be looked up. It is however possible to check if an e-mail address is already registered with MyPup by using the GetAccount call.

CreateAccount

Location /v1/Account/CreateAccount

If no account exists (username and/or e-mail address) a new account will be created with the specified information. If the account already exists by the specified username, you will get an error message.

See SetAccountMutationConfig for the attributes that can be set at the optional mutationConfig field. Setting a userUid in this object is obviously not required.

{
    # Mandatory Fields
    "emailAddress": "",             # Email address, also used for e-mail messages
    "firstName": "",                # First name, used in communication
    "lastName": "",                 # Last name, used in communication
    "pickUpPointUid": "GUID",       # Specifies the Main PickUpPoint for new accounts

    # Optional Fields
    "phoneNumber": null,            # Mobile phone number, used for SMS messages
    "userName": null,               # If not specified the e-mail address will be used as the username.
    "languageCode": null,           # Communication language, e.g. 'nl', 'nl-NL', 'en-GB', 'en'
    "streetName": null,
    "streetNo": null,
    "mailbox": null,
    "city": null,
    "countryCode": null,            # Two letter (ISO 3166-1 alpha-2) country code of the address
    "mutationConfig": {}            # Optional (can be null) mutation config to apply to the account. 
                                    # See SetAccountMutationConfig call for available attributes.
}
POST /v1/Account/CreateAccount HTTP/1.1
Host: api.staging.mypup.app
Authorization: Bearer ......
Content-Type: application/json

{
    "emailAddress": "janjanssen@domain.com",
    "phoneNumber": "0612345678",
    "firstName": "Jan",
    "lastName": "Janssen",
    "pickUpPointUid": "ca54f971f26a49a39afbbf5ea90db5e6",
    "languageCode": null,
    "streetName": null,
    "streetNo": null,
    "mailbox": null,
    "city": null,
    "countryCode": null,
    "mutationConfig": {
        "canRemoveAutomatically": true
    }
}
{
  "userUid": "",                    # Unique identifier (if found)
  "userName": "jan...in.com",       # If newly created this is the same as the e-mail address
  "canManageUser": true/false,      # True when the authenticated user (you) can manage/change/see the 
                                    # user's details. If the account existed and is managed by another
                                    # tenant then this will be false and all the other fields are null.
                                    # tenant then this will be false and all the other fields are null.
  "firstName": "Jan",
  "lastName": "Janssen",
  "emailAddress": "janjanssen@domain.com",
  "phoneNumber": "0612345678",
  "mainPupUid": "ca5...b5e6",       # Linked main pick up point for this account.
  "mainPupName": "Pup Name",
  "languageCode": "en-GB",          # Optional language code of the account.
  "mailCode": "MyPup A...F",        # Mail delivery code of this account

  "success": true/false,            # Command executed successfully
  "error": null,                    # Error code (if any)
  "message": null                   # Error message (if any)
}
error code Description
Generic Error Codes Any of the generic error codes.
EmailAlreadyRegistered There is already another user with the same e-mail address as specified in the request. When a username and a different username has been specified, the e-mail address of the specified user(name) cannot be changed to the specified e-mail address.
InvalidPupUid Specified PickUpPointUid is invalid, not specified or does not exist.
AccessDenied User exists but you cannot access the account. The account is managed by another service provider. Use GetAccount to retrieve the account's unique identifier.
MutationConfigFailed User created successfully, but specified mutation configuration could not be updated.

CreateOrGetAccount

Location /v1/Account/CreateOrGetAccount

Retrieves an existing account based on the account's e-mail address and (optional) username. If no account exists (username and/or e-mail address) a new account will be created with the specified information. If the account already exists by the specified username, the account's e-mail address is updated to the specified e-mail address.

When the account exists but you cannot manage the account (isExisting is true and canManageUser is false) the result will contain the userUid of the existing user.

See SetAccountMutationConfig for the attributes that can be set at the optional mutationConfig field. Setting a userUid in this object is obviously not required.

{
    # Mandatory Fields
    "emailAddress": "",             # Email address, also used for e-mail messages
    "firstName": "",                # First name, used in communication
    "lastName": "",                 # Last name, used in communication
    "pickUpPointUid": "",           # Specifies the Main PickUpPoint for new accounts

    # Optional Fields
    "phoneNumber": null,            # Mobile phone number, used for SMS messages
    "userName": null,               # If not specified the e-mail address will be used as the username.
    "languageCode": null,           # Communication language, e.g. 'nl', 'nl-NL', 'en-GB', 'en'
    "streetName": null,
    "streetNo": null,
    "mailbox": null,
    "city": null,
    "countryCode": null,            # Two letter (ISO 3166-1 alpha-2) country code of the address
    "mutationConfig": {}            # Optional (can be null) mutation config to apply to the account. 
                                    # See SetAccountMutationConfig call for available attributes.
}
POST /v1/Account/CreateOrGetAccount HTTP/1.1
Host: api.staging.mypup.app
Authorization: Bearer ......
Content-Type: application/json

{
    "emailAddress": "janjanssen@domain.com",
    "phoneNumber": "0612345678",
    "firstName": "Jan",
    "lastName": "Janssen",
    "pickUpPointUid": "ca54f971f26a49a39afbbf5ea90db5e6",
    "languageCode": null,
    "streetName": null,
    "streetNo": null,
    "mailbox": null,
    "city": null,
    "countryCode": null,
    "mutationConfig": {
        "canRemoveAutomatically": true
    }
}
{
  "userUid": "",                    # Unique identifier (if found)
  "isExisting": true/false,         # Specifies if a user is newly created (false) or not (true)
  "userName": "jan...in.com",       # If newly created this is the same as the e-mail address
  "canManageUser": true/false,      # True when the authenticated user (you) can manage/change/see the 
                                    # user's details. If the account existed and is managed by another
                                    # tenant then this will be false and all the other fields are null.
  "firstName": "Jan",
  "lastName": "Janssen",
  "emailAddress": "janjanssen@domain.com",
  "phoneNumber": "0612345678",
  "mainPupUid": "ca5...b5e6",       # Linked main pick up point for this account.
  "mainPupName": "Pup Name",
  "languageCode": "en-GB",          # Optional language code of the account.
  "mailCode": "MyPup A...F",        # Mail delivery code of this account

  "success": true/false,            # Command executed successfully
  "error": null,                    # Error code (if any)
  "message": null                   # Error message (if any)
}
error code Description
Generic Error Codes Any of the generic error codes.
EmailAlreadyRegistered There is already another user with the same e-mail address as specified in the request. When a username and a different username has been specified, the e-mail address of the specified user(name) cannot be changed to the specified e-mail address.
InvalidPupUid Specified PickUpPointUid is invalid, not specified or does not exist.
AccessDenied User exists but you cannot access the account. The account is managed by another service provider. Use GetAccount to retrieve the account's unique identifier.
MutationConfigFailed User created or updated successfully, but specified mutation configuration could not be updated.

UploadAccountSuggestions

Location /v1/Account/UploadAccountSuggestions

You can use the uploaded account information as an account suggestion to easily create new accounts when registering a new package. This data will then be visible as a suggestion within the search results for accounts.

Only the account data from the last imported file will be active and is available during registration of a new parcel. All previous uploads will expire automatically after a new file has been uploaded.

Note that accounts are uniquely identified on the e-mail address. Account information uploaded here will not automatically create a MyPup account using that data. Therefore this data cannot be found under the accounts .

Use the file example to create your own import file.

Example file: example.csv

EmailAddress;PhoneNumber;LanguageCode;FirstName;LastName;Remarks;PickUpPoint
john@example.com;+3161234578;NL;John;Doe;This is a test;Mypup HQ
jane@example.com;+3168764321;NL;Jane;Doe;This is a test;Mypup HQ

Info

This request must be sent as form data (content-type: multipart/form-data).
Store the JSON object under the name data and the file as name file. Both elements are mandatory.

See the example.

Info

Excel files (ended with .xls and .xlsx) and Comma-separated values (with delimiter the ; are supported).

{
    # Optional Fields
    "reference": "",                # If no reference is provided, the file name is used
}
POST /v1/Account/UploadAccountSuggestions HTTP/1.1
Host: api.staging.mypup.app
Authorization: Bearer ......
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data"
Content-Type: application/json

{ "Reference": "Example reference" }

Content-Disposition: form-data; name="file"; filename="/C:/temp/example.csv"
Content-Type: text/csv

(data)
----WebKitFormBoundary7MA4YWxkTrZu0gW
{
  "reference": "example.csv",                               # Reference of the upload. If no reference is provided, the file name is used                                   
  "totalCount": 4,                                          # Total number of accounts found in the file

  "importedCount": 0,                                       # Imported accounts
  "existedCount": 3,                                        # Existed accounts
  "removedCount": 0,                                        # Removed accounts
  "errorCount": 1,                                          # Errors found in file
  "dateTime": "2021-06-30T12:58:44.0115757Z",               # Date time of the upload

  "errorLogs": [{                                           # Error messages found in the file
    "id": "john@example.com",                               # Identification where the error in the file was found
    "message": "Phone number needs to be in an international format starting with either a + or 00"
  }],

  "success": true/false,                                    # Command executed successfully
  "error": null,                                            # Error code (if any)
  "message": null                                           # Error message (if any)
}
error code Description
Generic Error Codes Any of the generic error codes.
MissingFile No file specified.
InvalidHeader Invalid file headers specified.
InvalidImportType File type is not supported
NoRequestData No request data object specified
NoRequestFile No request file specified