We allow our customers and partners to fully integrate with our services. The Digicust API is extensive, well-documented, and easy to get started with.
Prerequisites
You have an active customer account
You have a user account with email-password authentication
Your execution strategy is properly set up. An execution strategy defines how customs cases are being processed. You can manage your execution strategies in our web app.
If you do not fulfill the above prerequisites, please create a new account with https://app.digicust.com/
Authentication
You need an access token for all requests. Fetch your access token with the following code:
constauthenticate=async () => {constdata= { username:'<YOUR USERNAME>', password:'<YOUR PASSWORD>', };try {constresponse=awaitfetch('https://api.digicust.com/generic/api/auth/authenticate', { method:'POST', headers: {'Content-Type':'application/json', }, body:JSON.stringify(data), });constjsonData=awaitresponse.json();if (!response.ok) {thrownewError(jsonData.error ||'Something went wrong'); }constaccessToken=jsonData.access_token;console.log(accessToken);// Save accessToken in some variable, or use directly// ... } catch (err) {console.error('Error:', err); }};
constaxios=require('axios');constauthenticate=async () => {constdata= { username:'<YOUR USERNAME>', password:'<YOUR PASSWORD>', };try {constresponse=awaitaxios.post('https://api.digicust.com/generic/api/auth/authenticate', data, { headers: {'Content-Type':'application/json', }, });constaccessToken=response.data.access_token;console.log(accessToken);// Save accessToken in some variable, or use directly// ... } catch (err) {console.error('Error:', err); }};
Imports System.Net.Http
Imports System.Text
Imports System.Threading.Tasks
Imports Newtonsoft.Json
Public Async Function Authenticate() As Task
Dim url As String = "https://api.digicust.com/generic/api/auth/authenticate"
Dim client As HttpClient = New HttpClient()
Dim user = New With {Key .username = "<YOUR USERNAME>", Key .password = "<YOUR PASSWORD>"}
Dim json As String = JsonConvert.SerializeObject(user)
Dim data As New StringContent(json, Encoding.UTF8, "application/json")
Dim response As HttpResponseMessage = Await client.PostAsync(url, data)
Dim result As String = Await response.Content.ReadAsStringAsync()
Dim tokenResponse As Dictionary(Of String, String) = JsonConvert.DeserializeObject(Of Dictionary(Of String, String))(result)
Dim accessToken As String = tokenResponse("access_token")
Console.WriteLine(accessToken)
' Save accessToken in some variable, or use directly
' ...
End Function
import requestsimport jsondefauthenticate(): data ={'username':'<YOUR USERNAME>','password':'<YOUR PASSWORD>',} headers ={'Content-Type':'application/json',}try: response = requests.post('https://api.digicust.com/generic/api/auth/authenticate', headers=headers, data=json.dumps(data))if response.status_code !=200:raiseException('Request failed with status {}'.format(response.status_code)) response_data = response.json() access_token = response_data['access_token']print(access_token)# Save accessToken in some variable, or use directly# ...exceptExceptionas e:print('Error:', e)authenticate()