Getting Started
...
UpStart Commerce APIs
Consumer APIs
Logged-In Bearer Token
9min
this section explains obtaining a bearer token for a logged in customer and outlines how an anonymous user can register to access more exclusive functionalities for upstart commerce consumer apis generate a logged in bearer token step 1 register as a customer to begin, first register as a customer to establish a more permanent customer profile through our upstart commerce portal ui access the portal and log in using your credentials (email and password) if you are not already registered, you can follow this link to create your sandbox account for details on creating and registering customer, go to the customer management guide step 2 obtain an anonymous token to obtain a logged in bearer token, you need to obtain an anonymous token if you have not obtained an anonymous token , visit anonymous bearer token docid\ qr7k yfbaxlavtwpckpgw guide for detailed information step 3 obtain an access and refresh token copy the curl below to obtain an access and refresh token and replace the following values in the header replace {{tenant header field name}} and {{site header field name}} with your specific values in the header of your request replace your "anonymous bearer token" generated in step 2 within the " authorization" header of your request replace your "login" and "0password" with your specific values obtained while registering customers in the header request curl location 'https //nochannel test 1 api nochannel test upstart team/ /v1/customer/login/token' \\ \ header 'content type application/json' \\ \ header 'x upstart tenant \<your tenantid> \\ \ header 'x upstart site \<your siteid> \\ \ header 'authorization bearer \<your bearertoken>' \\ \ data '{ "password" "\<your password>", "login" "test" }' for more information, go to the log in user endpoint example request step 4 check the status code upon making an access and refresh token creation request, it responds with a status code indicating the outcome success (http 200) the server has successfully processed your request error responses http 401 the server was unable to process the request check and ensure that the provided credentials are valid http 403 the request contains valid credentials, but the user's roles may be insufficient or the credentials may be expired step 5 access and refresh token obtained successfully after executing the curl above, you have successfully obtained a valid response for an "accesstoken" and "refreshtoken" copy these values and paste them into the authorization field response { "accesstoken" "\<your accesstoken>", "refreshtoken" "\<your refreshtoken>" } access tokens serve as short term credentials for accessing upstart commerce apis, while refresh tokens act as a mechanism to renew access tokens and maintain customer sessions over a more extended period during exploration make your first api call with logged in bearer token to make your first call by using a logged in bearer token, you need to replace your above obtained "logged in bearer token" in the request authorization header by using the curl below request curl location 'https //nochannel test 1 api nochannel test upstart team/v1/customer/profile' \\ \ header 'x upstart tenant \<your tenantid>' \\ \ header 'content type application/json' \\ \ header 'x upstart site \<your siteid>' \\ \ header 'authorization bearer \<accesstoken obtained from step 5>'\\ response { "addresses" { "addresses" \[ { "businessname" "telesalesguru", "city" "conneticut", "country" "stamford", "county" "united states", "label" "home", "name" { "first" "john", "last" "doe", "middleinitial" "d ", "salutation" "mr ", "suffix" "sr " }, "phonenumber" "12031234567", "pobox" false, "postalcode" "06901", "stateorregion" "ct", "street1" "1 landmark square", "street2" "avenue square" } ], "defaultbilling" { "businessname" "telesalesguru", "city" "conneticut", "country" "stamford", "county" "united states", "label" "home", "name" { "first" "john", "last" "doe", "middleinitial" "d ", "salutation" "mr ", "suffix" "sr " }, "phonenumber" "12031234567", "pobox" false, "postalcode" "06901", "stateorregion" "ct", "street1" "1 landmark square", "street2" "avenue square" }, "defaultshipping" { "businessname" "telesalesguru", "city" "conneticut", "country" "stamford", "county" "united states", "label" "home", "name" { "first" "john", "last" "doe", "middleinitial" "d ", "salutation" "mr ", "suffix" "sr " }, "phonenumber" "12031234567", "pobox" false, "postalcode" "06901", "stateorregion" "ct", "street1" "1 landmark square", "street2" "avenue square" } }, "birthdate" "1991 05 17", "creditcards" { "cards" \[ { "cardnumber" "8111", "cardtype" "visa", "expirationmonth" "10", "expirationyear" "2025", "label" "personal", "token" "65fzg3456z756jh345" } ], "default" { "cardnumber" "8111", "cardtype" "visa", "expirationmonth" "10", "expirationyear" "2025", "label" "personal", "token" "65fzg32byz75456345" } }, "defaultlocationid" "ced8ef74 c968 47f6 98e0 d780d3da85fb", "emailaddresses" { "addresses" \[ { "address" "telesalesguru\@soxmail com", "label" "work email" } ], "default" { "address" "telesalesguru\@soxmail com", "label" "work email" } }, "gender" "m", "id" "ced8wf74 c968 47f6 98e0 cbe5fb", "login" "bob smith 29", "name" { "first" "bob", "last" "smith", "middleinitial" "d ", "salutation" "capt ", "suffix" "sr " }, "registrationdate" "2020 07 21t17 32 28z", "siteids" \[ "c60e4f26 cb81 41c5 a1aa 856550be5228" ], "subscriptions" { "addresscatalogs" \[ { "address" { "businessname" "telesalesguru", "city" "conneticut", "country" "stamford", "county" "united states", "label" "home", "name" { "first" "john", "last" "doe", "middleinitial" "d ", "salutation" "mr ", "suffix" "sr " }, "phonenumber" "12031234567", "pobox" false, "postalcode" "06901", "stateorregion" "ct", "street1" "1 landmark square", "street2" "avenue square" }, "label" "the big catalog" } ], "emailcatalogs" \[ { "email" "example\@example com", "label" "daily deals" } ], "emailnewsletters" \[ { "email" "example\@example com", "label" "newsletter" } ] } } for more information, go to the get customer profile endpoint example request upon receiving the successful response to the get customer profile request, you have completed your first upstart commerce consumer api call, using the logged in bearer token