This is a detailed TUTORIAL on how to create a NEW Member by using CryptMin API.
Note: The content of this document is targeted to Developers who want to integrate with our CryptMin membership Application Program Interface.
Request Basics
- Base URL Endpoint: https://cryptmin.com/api/index.php/v2
- Content Type: application/json
- Authorization: HTTP Basic Authorization:
- Username: CryptMin client account username ("testbase" for testing)
- Password: CryptMin client private API key ("testPrivateKey123" for testing)
Note: Production username & API key(s) will be provided once successful transactions using the test credentials have been confirmed.
Create Member
This function is used to create a NEW Member account. You must provide all mandatory fields marked with an asterisk (*) for the account to function properly.
We keep track of the username provided, thus a username used in your system shall be passed into the sponsor field. In other words, we expect the username associated with the account NOT to be changed in your system. Also, any duplicate create member account request will result in an error.
URL Endpoint: https://cryptmin.com/api/index.php/v2/member | Method: POST
Request Fields
- username: Unique value used in your system to identify the member. Alphanumeric. Max 50 characters. Mandatory.
- email: Email address of the member. Max 50 characters. Mandatory.
- sponsor: Username of the sponsor. Alphanumeric. Max 50 characters. Optional. Defaults to your company's root member if not provided.
- signupType: Member's account type. Numeric. 0 for customer, 1 for distributor. Optional. Defaults to distributor (1) if not provided.
- companyName: Company name. Alphanumeric. Max 50 characters. Optional.
- fname: First name. Alphanumeric. Max 50 characters. Mandatory. | lname: Last name. Alphanumeric. Max 50 characters. Mandatory.
- homephone: Home phone number. Max 25 digits. Mandatory if phonePref is not provided or specified as 0.
- cellphone: Cell phone number. Max 25 digits. Mandatory if phonePref is specified as 2.
- phonePref: Preferred contact phone number option. 0 for home phone, 2 for cell phone. Optional. Defaults to home phone (0) if not provided.
- dob: The date of birth of the member in YYYY-MM-DD format. Optional. Defaults to "1900-01-01" if not provided.
- addresses: An array of addresses. Mandatory. Must contain at least a record with an "addressTy" of 1. Each address should consist of:
- addressTy: Address type. 1 for default, 2 for shipping, 3 for signup-purposes-only, and 4 for misc. Mandatory.
- address1: First line of street address. Alphanumeric. Max 50 characters. Optional.
- address2: Second line of street address. Alphanumeric. Max 50 characters. Optional.
- suburb: The name of the suburb. Alphanumeric. Max 30 characters. Optional.
- city: The name of the city. Alphanumeric. Max 30 characters. Optional.
- zip: Zip/Postal Code. Alphanumeric. Max 10 characters. Optional.
- state: ISO 3166-2 country subdivision code. Mandatory. (for e.g. District of Columbia: "DC", Île-de-France: "J", Tokyo: "13")
- country: ISO 3166-1 alpha-2 country code. Mandatory. (for e.g. United States: "US", France: "FR", Japan: "JP")
Response Fields
- status: "ok" when the member is successfully created, and an "error" message if not.
- errors: Array of error messages. Will be empty if the status is "ok".
- rowCount: Number of records contained in the data body.
- timestamp: Unix timestamp of when the response was generated.
- data: Array of data. If the "status" is "ok", it would contain:
- memberId: Member's ID. MUST record this on your system against the member as it is required to make any future requests relating to this member, including detail update, login, order placement. Numeric.
- handle: Member's username on CryptMin. Automatically generated by CryptMin, and differs from the username parameter past in. Max 45 characters.
- sponsorId: Member ID of the sponsor. Numeric.
- sponsorHandle: Sponsor's username on CryptMin.
cURL Request Sample
curl -X POST \ https://cryptmin.com/api/index.php/v2/member \ -H 'Authorization: Basic dGVzdGJhc2U6dGVzdFByaXZhdGVLZXkxMjM=' \ -H 'Content-Type: application/json' \ -d '{ "username": "johnsmith01", "email": "johnsmith01@ins.com", "sponsor": "testbase", "companyName": "My Business Co.", "fname": "John", "lname": "Smith", "homecountrycode": "1", "homephone": "0000000000", "cellcountrycode": "1", "cellphone": "2222222222", "phonePref": 2, "dob": "1987-12-31", "addresses": [ { "addressTy": 1, "address1": "12 Home Street", "city": "New York", "zip": "10001", "state": "NY", "country": "US" }, { "addressTy": 2, "address1": "45 Shipping Avenue", "city": "Washington", "zip": "20002", "state": "DC", "country": "US" } ] }'
Successful Response Example
{ "status": "ok", "errors": [], "rowCount": 1, "timestamp": 1519378558, "data": [ { "memberId": "45302", "handle": "testbaseCM1519378558", "sponsorId": "10017", "sponsorHandle": "testbase" } ] }
Error Response Example
{ "status": "error", "errors": [ "Sorry, that Username has already been taken, please try again" ], "rowCount": 1, "timestamp": 1519381933, "data": "johnsmith01" }