Skip to content
English
  • There are no suggestions because the search field is empty.

How to create a token with curl

  • Prepare credentials: Gather client ID, client secret, library scope, grant type and request URL for the token request.
  • Construct POST request: Use curl to send a POST request with URL-encoded data to the token endpoint for token retrieval.
  • Handle response: Parse the JSON response from the server to extract the access token for subsequent requests.
  • Secure storage: Store the access token securely in your environment or script to avoid exposure. Each token is valid 1 hour from creation and can execute 100 API calls.

If your company is an existing Swift+ API customer then someone within your organization should already have this information to share internally. If your company is new to Swift+ APIs then an API team member will request and send these details to your organization. 

Library API Scope
Inventory Open api://swift-open-inventory-api/.default
Loading Open api://swift-open-loading-api/.default
Shipping Open api://swift-open-shipping-api/.default
Billing Open api://swift-open-billing-api/.default
Locations Open api://swift-open-locations-api/.default
Products Open api://swift-open-products-api/.default
  Inventory Mock   api://swift-mock-inventory-api/.default
  Loading Mock   api://swift-mock-loading-api/.default
  Shipping Mock   api://swift-mock-shipping-api/.default
  Billing Mock   api://swift-mock-billing-api/.default
  Locations Mock   api://swift-mock-locations-api/.default
  Products Mock   api://swift-mock-products-api/.default

Scopes are specific to each API library. You must create a new token if you switch to a different library.

grant_type: client_credentials
request url: https://login.microsoftonline.com/d8088b60-8534-41bd-a682-1ad5ee71069a/oauth2/v2.0/token 

Example POST request:

curl -H "Content-Type: application/x-www-form-urlencoded" -d "client_id=pasteyourclientIDhere&client_secret=pasteyourclientsecrethere&scope=pasteyourselectedscopehere&grant_type=client_credentials" -X POST https://login.microsoftonline.com/d8088b60-8534-41bd-a682-1ad5ee71069a/oauth2/v2.0/token