10.1. Fetching contacts with cURLΒΆ

This example shows how company contacts can be fetched using bearer token for request authorization.

curl --location --request GET 'https://cargox.digital/api/v3/companies/self/contacts/list/' \
    --header 'Authorization: Bearer acaYpzlT7OL6gw1yI9W1ovtTZtFmQa'

If the bearer token is valid, the above cURL command returns the following JSON response:

[
    {
        "company_id": "aa69e1b4-a6ef-4a64-aa17-6c3f7adf8662",
        "company": {
            "name": "Inviter company",
            "branch": null,
            "address": "Sample street 123",
            "address2": "",
            "postal_code": "1234",
            "city": "Ljubljana",
            "country": "SI",
            "country_name": "Slovenia",
            "website": "https://cargox.io",
            "vat_number": null,
            "logo": null,
            "logo_name": "",
            "id": "aa69e1b4-a6ef-4a64-aa17-6c3f7adf8662"
        },
        "my_inbox_id": "96bf8b27-65fb-4c46-9f10-067441916eaa",
        "their_inbox_id": "dd41e532-f1a2-4662-bd4a-bd16c96e8a17",
        "their_inbox": {
            "company_id": "d38ae6ce-1f33-4ed0-9f25-6b6c8f860680",
            "company": {
                "name": "Contact company",
                "branch": null,
                "address": "Sample boulevard 55",
                "address2": "",
                "postal_code": "98767",
                "city": "Bern",
                "country": "CH",
                "country_name": "Switzerland",
                "website": null,
                "vat_number": null,
                "logo": null,
                "logo_name": "",
                "id": "d38ae6ce-1f33-4ed0-9f25-6b6c8f860680"
            },
            "name": "Default",
            "ethereum_address": "0x29B4E3715E9926D50eAbDfAE3619d097128926C5",
            "id": "dd41e532-f1a2-4662-bd4a-bd16c96e8a17"
        },
        "email": null,
        "message": null,
        "note": null,
        "invitation_code": null,
        "status": "accepted",
        "created": "2020-05-27T09:13:38.521230Z",
        "created_by_id": "0102f020-6307-4a60-b7bb-c8a7dbea4d9d",
        "created_by": {
            "name": "John Smith",
            "first_name": "John",
            "last_name": "Smith",
            "email": "[email protected]",
            "telephone": null,
            "company_id": "aa69e1b4-a6ef-4a64-aa17-6c3f7adf8662",
            "company": {
                "name": "Inviter company",
                "branch": null,
                "address": "Sample street 123",
                "address2": "",
                "postal_code": "1234",
                "city": "Ljubljana",
                "country": "SI",
                "country_name": "Slovenia",
                "website": "https://cargox.io",
                "vat_number": null,
                "logo": null,
                "logo_name": "",
                "id": "aa69e1b4-a6ef-4a64-aa17-6c3f7adf8662"
            },
            "logo": null,
            "logo_name": "",
            "id": "0102f020-6307-4a60-b7bb-c8a7dbea4d9d"
        },
        "resolved": "2020-05-27T09:13:38.289849Z",
        "resolved_by_id": "a0f9e92b-54c2-45ce-aa61-97e2ae757549",
        "resolved_by": {
            "name": "Jane Doe",
            "first_name": "Jane",
            "last_name": "Doe",
            "email": "[email protected]",
            "telephone": null,
            "company_id": "d38ae6ce-1f33-4ed0-9f25-6b6c8f860680",
            "company": {
                "name": "Contact company",
                "branch": null,
                "address": "Sample boulevard 55",
                "address2": "",
                "postal_code": "98767",
                "city": "Bern",
                "country": "CH",
                "country_name": "Switzerland",
                "website": null,
                "vat_number": null,
                "logo": null,
                "logo_name": "",
                "id": "d38ae6ce-1f33-4ed0-9f25-6b6c8f860680"
            },
            "logo": null,
            "logo_name": "",
            "id": "a0f9e92b-54c2-45ce-aa61-97e2ae757549"
        },
        "contact_person": {
            "name": "Jane Doe",
            "first_name": "Jane",
            "last_name": "Doe",
            "email": "[email protected]",
            "telephone": null,
            "company_id": "d38ae6ce-1f33-4ed0-9f25-6b6c8f860680",
            "company": {
                "name": "Contact company",
                "branch": null,
                "address": "Sample boulevard 55",
                "address2": "",
                "postal_code": "98767",
                "city": "Bern",
                "country": "CH",
                "country_name": "Switzerland",
                "website": null,
                "vat_number": null,
                "logo": null,
                "logo_name": "",
                "id": "d38ae6ce-1f33-4ed0-9f25-6b6c8f860680"
            },
            "logo": null,
            "logo_name": "",
            "id": "a0f9e92b-54c2-45ce-aa61-97e2ae757549"
        },
        "id": "fe01f72e-8599-4081-bcec-ed5b9301d039"
    },
    ...
]

If bearer token is invalid or expired, the following 403 Forbidden response is returned:

{
    "detail": "Authentication credentials were not provided."
}