# Getting Started

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 <a href="#id-76620356-664a-4877-9b2b-cf34ddfbdb72" id="id-76620356-664a-4877-9b2b-cf34ddfbdb72"></a>

* 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 <a href="#id-3da021d9-5681-4099-a523-3f80a07bcc12" id="id-3da021d9-5681-4099-a523-3f80a07bcc12"></a>

You need an access token for all requests. Fetch your access token with the following code:

{% tabs %}
{% tab title="CURL" %}

```bash
curl -X 'POST' \
  'https://api.digicust.com/generic/api/auth/authenticate' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "username": "<YOUR USERNAME>",
  "password": "<YOUR PASSWORD>"
}'
```

{% endtab %}

{% tab title="JavaScript (fetch)" %}

```javascript
const authenticate = async () => {
  const data = {
    username: '<YOUR USERNAME>',
    password: '<YOUR PASSWORD>',
  };
  try {
    const response = await fetch('https://api.digicust.com/generic/api/auth/authenticate', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify(data),
    });

    const jsonData = await response.json();

    if (!response.ok) {
      throw new Error(jsonData.error || 'Something went wrong');
    }

    const accessToken = jsonData.access_token;
    console.log(accessToken);

    // Save accessToken in some variable, or use directly
    // ...
  } catch (err) {
    console.error('Error:', err);
  }
};
```

{% endtab %}

{% tab title="JavaScript (axios)" %}

```javascript
const axios = require('axios');

const authenticate = async () => {
  const data = {
    username: '<YOUR USERNAME>',
    password: '<YOUR PASSWORD>',
  };

  try {
    const response = await axios.post('https://api.digicust.com/generic/api/auth/authenticate', data, {
      headers: {
        'Content-Type': 'application/json',
      },
    });

    const accessToken = response.data.access_token;
    console.log(accessToken);

    // Save accessToken in some variable, or use directly
    // ...
  } catch (err) {
    console.error('Error:', err);
  }
};
```

{% endtab %}

{% tab title="Visual Basic.NET" %}

```visual-basic
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
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json


def authenticate():
    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:
            raise Exception(
                '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
        # ...

    except Exception as e:
        print('Error:', e)


authenticate()
```

{% endtab %}
{% endtabs %}

For more details: <https://api.digicust.com/generic/api-docs/#/Auth/post_api_auth_authenticate>

### Documentation <a href="#id-527d8358-f651-44c7-9310-2e9dd2bea11d" id="id-527d8358-f651-44c7-9310-2e9dd2bea11d"></a>

Find detailed documentation on available endpoints here:

| **Upload API**  | <https://api.digicust.com/upload/api-docs/>  |
| --------------- | -------------------------------------------- |
| **Generic API** | <https://api.digicust.com/generic/api-docs/> |
| **Types**       | <https://types.api.digicust.com/>            |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guide.digicust.com/developer-api/getting-started.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
