First API Call

Step-by-step instructions for setting a request to the CargoDocs API

Step 1: Retrieve Authorization Token

Refer to Authentication and retrieve your API authentication token by passing the user credentials to the OAuth authorization URL at https://api.domain.cargodocs.com/v3/common/auoth2/token

Here is how a token is generated.

curl --location --request GET 'https://api.cargodocs.com/v3/common/oauth2/token' \
--header 'Password: vH3OJ4xS$5' \
--header 'Username: Bumblebee'

The above request generates a token as follows.

{
    "token": "eyJraWQiOiJ3YitJMjNzOWRCNUh0cjBhQXVwTHVjeFwvUFhWREhlVEcyQWpTNnkyNFBjYz0iLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJiMjNmMDNlNi1lNDIwLTRjODEtOGIzZS1hOGM5MmYzZGQ0OTQiLCJkZXZpY2Vfa2V5IjoiZXUtd2VzdC0xXzMzODMxNzlmLTAyNTQtNDE4MC1hZWM4LWNhN2Q3ZTVmZTkyNCIsImV2ZW50X2lkIjoiODQ3NGEyZWQtZTYzZC00NmY5LWJlNmMtMWViNTc0YzcwZGNjIiwidG9rZW5fdXNlIjoiYWNjZXNzIiwic2NvcGUiOiJhd3MuY29nbml0by5zaWduaW4udXNlci5hZG1pbiIsImF1dGhfdGltZSI6MTY0NTUzMjIwNywiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLmV1LXdlc3QtMS5hbWF6b25hd3MuY29tXC9ldS13ZXN0LTFfSnN6bUZoejRoIiwiZXhwIjoxNjQ1NTM1ODA3LCJpYXQiOjE2NDU1MzIyMDcsImp0aSI6ImNkODlhMDBhLTg3MWUtNDkzYy1hNTIwLWM3OWU2ZGEwOTUxMCIsImNsaWVudF9pZCI6IjNwZHZrbWEzdDM5bnNxamFyamlmM2k0ZmlkIiwidXNlcm5hbWUiOiJWb2x0cm9uIn0.banOsyWt57Um_XdqteVBuRDIim8Q_KG1IMRLc7bsXJNoI_fmQi95sc7a2-fCyjFG4z4ryA5dmYaXGdX3Gk7PFUyr5EYhJavt18OY7jbdU1IUNRhiI4zlngev4ibCWiTp6HSwDk9NOao8v8qgjUVwWVuNcbnNbmjnyIs0-m8NS3FtkoeC4_V5HVWYrd2XCQJFheG50qu2I2RXHmd-JfiJAGa9ALSDVIUYElkm4m0xUucHqXybwzRHszhCyDVpmR4Iz0BI8EMe5AAkJtN-rW_UJTMDlQeL7qCJJsasoeMcHWLgr3Dqq0Y21FgQu2K7JE0ZpvnRGjAE0YD4X3quXEW4NA"
}

Step 2: Consume Endpoint

Below is a sample URL with the appropriate authorization code and body.

curl --location --request POST 'https://api-test.cargodocs.com/v3/common/sets/search' \
--header 'Authorization: Bearer eyJraWQiOiJPUUJmaXR6KzBWOFlxWFp3N2lHc1hlWjB5T2I3RTNyekpGWGZUYm9cL0M0Yz0iLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJjODU2NzIxZC0wMmEyLTQ0MzItYWRhMy0xNDVjMGYxZTY4ZjIiLCJldmVudF9pZCI6Ijg0M2ExNWVhLTdjY2UtNDliZC1iYWI5LTY5ZDE5ZThlM2VjZiIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoiYXdzLmNvZ25pdG8uc2lnbmluLnVzZXIuYWRtaW4iLCJhdXRoX3RpbWUiOjE2NTI4NjgyMDEsImlzcyI6Imh0dHBzOlwvXC9jb2duaXRvLWlkcC5ldS13ZXN0LTEuYW1hem9uYXdzLmNvbVwvZXUtd2VzdC0xX1drRmF1Q2tnUSIsImV4cCI6MTY1Mjg3MTgwMSwiaWF0IjoxNjUyODY4MjAxLCJqdGkiOiJlZDBhZTQ2OC1kNWJjLTQ3ZTMtYTQzZC1mYzkwZWI1MGE5ZDkiLCJjbGllbnRfaWQiOiI3bzh0dDI4OWNvNHU5NnQ5bHQ1MnFyMnZxYSIsInVzZXJuYW1lIjoiekxpbmVyUGlsVXNlcjEifQ.FwVgGDwchBiP-kTGO1Fj8PHv0NFuG4yqdXCKyDS7O9Vfnyge-X736x17VQdVJHtGwgcRAmawQhI9lXmT3tdhb1rIrf_NGSqsjIGUZaXD-ECiPKmvr5mzdGQWxNkTLzjNA8pLVBF6CqqP5MnQ8uvGWvxrIJHidLafGVARq6toyJSUEWy1RXS488buMAQlyl898wcxUTKQJvbu7Wv2LYfF2yqKrR07G8zYzrcPSamtDyPGrTz94UfRDZPF30kZlqeJOgVUgda780qmQs8UIIBe79UPDjky2qyReIi8HmG6jd7WlTpr7NIjo1tuPrSCASWXmHPC_4PyCop0xr4Ao8_pPA' \
--header 'Content-Type: application/json' \
--data-raw '{
"status": "ACTIVE",
"instance": "DOCEX",
 "customerIds": ["df192c5e-701e-4e58-9b8d-d0daf7404109"],
 "shipmentRef": "SRIDINO200420227"
}'

📘

Multi-Languages Support

Here at CargoDocs API documentation, we will always give out sample codes in different development languages to support most of the developers. The API References endpoints have more than 20 programming languages.

This request is responded by a 200 Response Code with the following JSON.

{
    "code": 200,
    "status": "OK",
    "data": {
        "offset": 0,
        "limit": 100,
        "total": 1,
        "count": 1,
        "results": [
            {
                "setId": "627fc311-515f-4b76-811b-0c02d845a966",
                "transactionId": "f41acec7-63e6-48a4-a086-43ba641a58db",
                "parcelRef": "P-SRIDINO220320221",
                "shipmentRef": "SRIDINO200420227",
                "status": "signed",
                "destinationName": "LAEM CHABANG PORT",
                "destinationCountry": "Thailand",
                "cargoName": "Generic Liner Cargo",
                "modifiedDate": "9 May 2022 10:50",
                "fromParty": null,
                "fromPartyId": null,
                "documents": [
                    {
                        "name": "PIL Singapore",
                        "documentId": "36e6953f-41f4-42b3-8540-19fd99d60b91",
                        "docType": "Bill of Lading",
                        "xmlContent": null
                    },
                    {
                        "name": "Cargo Manifest",
                        "documentId": "58487c7b-3471-4718-ac70-e789794617df",
                        "docType": "Uploadable Document",
                        "xmlContent": null
                    }
                ],
                "actions": null,
                "billOfLadingDate": "2022-03-14",
                "signature": "1 of 1",
                "quantity": "null null",
                "consignorCompanyName": "zExchange 10A",
                "consigneeCompanyName": "zExchange 2",
                "loadPort": "MUNDRA, INDIA",
                "vesselName": null,
                "links": []
            }
        ]
    },
    "links": []
}