Introduction
The Shoprocket API is organised around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.
Endpoint: https://api.shoprocket.io/v1/
API Version: 1.0
Authentication
To authorise, use this code:
# With shell, you can just pass the correct header with each request
curl "api_endpoint_here" \
-H "sr_auth: sr_test_pk_24dccd18653374dddc6237547dfbae9dccf"
Make sure to replace
sr_test_pk_24dccd18653374dddc6237547dfbae9dccf
with your API key.
Shoprocket uses API keys to allow access to the API. You can get your API keys in your dashboard (https://shoprocket.io/dashboard/api-keys/).
Shoprocket expects for the API key to be included in all API requests to the server in a header that looks like the following:
sr_auth: sr_test_pk_24dccd18653374dddc6237547dfbae9dccf
Test mode secret keys have the prefix sk_test_
and live mode secret keys have the prefix sk_live_
.
Stores
Create New Store
Make sure to replace
sr_cid_d879f7bd91b9f56def659ad18f3745b9365
with your Client ID.
curl "/v1/stores" \
-H "sr_auth: sr_cid_d879f7bd91b9f56def659ad18f3745b9365" \
-H "Content-Type: application/json" \
-d "{
store_name: Shoprocket Demo Store
registered_name: Shoprocket
address_line1: St.Lewis #2222
address_country: us
address_city: Los Angeles
address_zipcode: 90001
subdomain:
}"
The above endpoint returns JSON structured like this:
{
"status": 200,
"message": "Your store is saved successfully.",
"data": {
"store": {
"id": "539",
"store_id": "539",
"locale": "en-GB",
"weight_unit": "lb",
"dimensions_unit": "cm",
"timezone": "America/Los_Angeles",
"store_hostname": "localhost",
"customer_email": null,
"staff_emails": null,
"low_stock_count": "10",
"order_id_prefix": "#",
"order_id_suffix": null,
"abandoned_cart_interval": null,
"use_stock": "0",
"capture_billing_address": "1",
"capture_shipping_address": "1",
"remove_branding": "0",
"enable_product_sorting": "0",
"show_categories_filter": "1",
"product_sorting": null,
"product_pagination": "0",
"product_pagination_type": null,
"product_image_placeholder": null,
"default_currency": "53",
"default_currency_symbol": "Rp",
"default_language": "1",
"tax_preference": "manual",
"taxjar_api_key": null,
"ga_code": null,
"google_ads_tracking_id": null,
"fb_pixel_id": null,
"pinterest_tag_id": null,
"snapchat_pixel_id": null,
"twitter_tracking_id": null,
"custom_tracking_code": null,
"subdomain": "qmfqw7",
"cname": null,
"privacy_policy_url": "https://www.example.com",
"privacy_policy_text": null,
"default_terms_and_conditions": "1",
"default_opt_in_marketing": "1",
"product_quantity_dropdown_limit": "10",
"status": "1",
"deleted_at": null,
"created_at": "2021-07-07 19:07:29",
"updated_at": "2021-07-07 13:37:36",
"customer_id": null,
"store_name": "Shoprocket Demo Store",
"store_logo": null,
"store_environment": "test",
"registered_name": "Shoprocket",
"address_line1": "St. Lewis #2222",
"address_line2": null,
"address_city": "Los Angeles",
"address_state": null,
"address_country": "96",
"address_zipcode": "90001",
"is_paused": "0",
"is_widget": "0",
"test_publishable_key": "sr_test_pk_699b404ca53908efb91c43bf1c3782dfda9",
"live_publishable_key": "sr_live_pk_233ca70292c2d6fde895394313549bd10bf",
"test_secret_key": "sr_live_sk_0f4a6772d4caaa4b2e65395ac82015908ea",
"live_secret_key": "sr_live_sk_887f4a7c05395e28daf2214ea3862fdd26e",
"subscription_id": "551",
"subscription_start_date": null,
"subscription_end_date": null,
"subscription_cancels_at": null,
"subscription_status": "0",
"partner_id": "2",
"v1_ref": null,
"settings_revised": "2021-07-07 13:37:36",
"store_address": "St. Lewis #2222, Los Angeles, United States, 90001."
}
}
}
Create a new store.
HTTP Request
PUT https://shoprocket.io/v1/stores
Request Data
Parameter | Optional | Default | Description |
---|---|---|---|
store_name | no | The store name displayed in Store Front. | |
registered_name | no | The official name registered. | |
address_line1 | no | The store address Line1. | |
address_line2 | yes | The store address Line2. | |
address_country | no | A two-letter ISO code of the country. | |
address_city | no | The store address City. | |
address_zipcode | no | Postal code or ZIP code of the Store Country. | |
subdomain | yes | Unique random string | Should be unique. If not filled, then a random subdomain will be created. |
staff_emails | yes | NULL | All admin notifications will be sent to the address(es) specified. You can enter multiple addresses by separating them with commas. |
order_id_prefix | yes | # | This will be added before Order Id. |
order_id_suffix | yes | NULL | This will be added after Order Id. |
weight_unit | yes | lb | Weight unit. Supported values: kg , lb , g , oz . |
dimensions_unit | yes | cm | Dimensions unit. Supported values: mm , cm , in , m , yd . |
ga_code | yes | NULL | Google analytics code. |
google_ads_tracking_id | yes | NULL | Google Ads conversion tracking ID. |
fb_pixel_id | yes | NULL | Facebook pixel lets you track your store visitors and their behavior — giving you a lot of data to optimise your Facebook ads, so you can retarget store visitors, track your ad results, get more conversions and boost sales. |
pinterest_tag_id | yes | NULL | Add a Pinterest Tag to see how many customers added products to the cart, started checkout, or placed an order after viewing your ads. |
snapchat_pixel_id | yes | NULL | Measure your Snapchat ads impact on the sales. Add a Snap Pixel to see how many snapchatters interact with your store after viewing your ads. |
twitter_tracking_id | yes | NULL | Twitter Tracking code enables you to measure your return on ad spend by tracking the actions people take after viewing or engaging with your ads on Twitter. |
custom_tracking_code | yes | NULL | Custom tracking code. |
privacy_policy_url | yes | NULL | The url which will show during checkout process. If both privacy_policy_url and privacy_policy_text will be given then it will be preferred. |
privacy_policy_text | yes | NULL | The text which will show during checkout process. |
Users
Create New User
curl "/v1/user" \
-H "sr_auth: sr_test_pk_24dccd18653374dddc6237547dfbae9dccf" \
-H "Content-Type: application/json" \
-d "{
email: [email protected]
password: 123456
}"
The above endpoint returns JSON structured like this:
{
"status": 200,
"message": "User registered successfully.",
"data": {
"user": {
"id": "661",
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"password": "******",
"phone_number": "95684*****",
"gender": null,
"dob": null,
"profile_picture": null,
"referral_code": "1e701c52f",
"referred_by": "326925ed5",
"is_pro": "0",
"client_id": "sr_cid_1aaeb2220652e0d6fa661917831f7035705",
"login_count": "0",
"password_token": null,
"role": "7",
"status": "1",
"v1_ref": null,
"deleted_at": null,
"created_at": "2021-07-07 19:12:53",
"updated_at": "2021-07-07 13:42:53"
}
}
}
Create a new user.
HTTP Request
PUT https://shoprocket.io/v1/user
Request Data
Parameter | Optional | Default | Description |
---|---|---|---|
no | The registration email. | ||
password | no | Account password. | |
first_name | yes | NULL | The user first name. |
last_name | yes | NULL | The user last name. |
phone_number | yes | NULL | The user contact number. |
referrer | yes | NULL | The referral code of the user who referred. |
Errors
The Shoprocket API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorised -- Your API key is wrong. |
403 | Forbidden -- The object requested is hidden for administrators only. |
404 | Not Found -- The specified object could not be found. |
405 | Method Not Allowed -- You tried to access a object with an invalid method. |
406 | Not Acceptable -- You requested a format that isn't json. |
410 | Gone -- The object requested has been removed from our servers. |
429 | Too Many Requests -- You're requesting too many objects |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |