Skip to main content
API Request Logs
Back
Throughout This Page
You can jump to the specified sections by clicking on these titles.

Overview

The API Request Logs page provides a comprehensive overview of incoming requests from individual API users to the system. This page is a central hub for reviewing the various API requests directed at your system.

Within this documentation, we will guide you through effectively utilising this page and its accompanying features. This guide will cover essential tasks such as conducting searches within the requests, interpreting log files, and comprehending request particulars like response codes.

Defining View

Upon successfully logging into your Shipping dashboard, navigate to the "API Request Logs" page by selecting it from the menu on the left-hand side of the interface.

To begin, you have the flexibility to customize the content displayed on the API Request Logs page. On the top right corner, you'll find a button that, when clicked, enables you to select the specific options you wish to have displayed. Utilize this feature to indicate your preferences for the content you want to view. Additionally, you can determine the visibility of specific columns through the "Column Selector" and designate your chosen filters in the "Filter Selector" section.

To conduct searches within your API requests, take advantage of our distinct search parameters, namely "REQUEST_ID" or "ID," both accessible to the left of the "Search" button.

  • REQUEST_ID: This identifier is determined by the user within their request. Typically, it corresponds to the UNIX timestamp denoting the request time. You can adopt this approach in scenarios where the "request_id" aligns with the request time. Moreover, the "request_id" content in your request JSON can be configured as per your requirements.
  • ID: The Courier API system assigns a unique global ID to each specific request. This numeric identifier is sequential and perpetually increasing. For instance, if a request bears an ID of "51," the subsequent request will be assigned an ID of "52."

Filtering by Date

You also have the option to specify a particular date range for viewing API requests. As demonstrated in the image below, selecting a date range within which our requests are present becomes necessary when the default date range does not yield any results.

To modify the date range, click on the calendar icon in the screen's top-right corner.

You will find two distinct options: one permits manual selection of a date range directly from the calendar, while the other provides a convenient "Fast Date Picker." The latter offers a variety of pre-defined date ranges frequently used, such as "This Week," "Last Week," "This Month," and more. It empowers you to swiftly narrow down your API request logs according to your needs.

Filters

Filters are powerful tools to fine-tune your search amidst the array of requests.

  • Request URL: The Request URL corresponds to the Courier API endpoint to which your request is directed. You can retrieve API Requests containing the specified keywords by inputting either the complete URL or a portion of it. It's unnecessary to input the entire request URL to apply this filter effectively. For instance, typing "RoyalMail" in the search field will display a comprehensive list of requests linked to Royal Mail. Similarly, if you seek "create-label" requests, a simple "create" filter will suffice.
  • API Account: Should you function as a reseller or agency, managing Courier API on behalf of diverse clients, the potential for multiple API user accounts exists (these accounts can be established in the "API Accounts" section). In this context, the API Account filter allows you to select the specific API account(s) for which you wish to evaluate requests.
  • Response Code: This pertains to the HTTP response code assigned to requests. By specifying the code within this filter, you can zero in on API requests of interest. For instance, entering and selecting the "400" code, as depicted in the image below, will exclusively present a list of requests bearing this particular response code.

Request Details

Once you've selected your desired date and applied filters, a comprehensive list of requests and their corresponding details will be presented. As illustrated in the image below, this section encompasses a range of more information and features, each of which we will examine individually:

  • Date Time: This field displays the precise date and time when the requests were transmitted.
  • Request Method: This column showcases the HTTP request methods employed for each request. Typically, these methods include GET and POST requests.
  • Request Authenticated: The numerical value here corresponds to the API user ID. As shown in the subsequent image, this number is distinct for each API account.
  • Duration (ms): This field denotes the duration between the moment the server received the request and the subsequent transmission of the response, with the time interval measured in milliseconds.

Furthermore, additional fields exist like ID, Request ID, Request URL, and API Account. These have been previously discussed within this documentation's "Search" and "Filters" sections.

Response Code

The Response Code refers to the HTTP response code. While sending requests, you may encounter several common response codes, each with its distinct implications:

  • 200: This code signifies that the request has been successfully processed.
  • 400: Indicating a client error, this code denotes that the server is unable or unwilling to proceed with the request due to perceived issues with the client's input.
  • 401: This code reflects an incomplete client request arising from a lack of valid authentication credentials for the specified resource. Among the most frequently encountered errors on the Courier API, this isn't a system flaw but rather an indication that the submitted information does not match the required criteria.
  • 500: This code indicates an unexpected server condition that hinders the fulfilment of the request. It's often employed when no other error code precisely fits the situation.

image-1692707157264.png

Logs

When you click on the Logs icon associated with any given request, you'll notice two distinct sections: "Request Data" and "Response Data." These sections provide insight into both the data sent and received. In the following areas, we'll delve into the details of the codes in both the request and response data.

  • Request Data: This section encompasses the body of the request sent to the Courier API. Below is an example of Request Data:
    • {

              "testing": true,

              "auth_company": "",

              "request_id": "",

              "format_address_default": true,

              "shipment": {

                      "label_size": "6x4",

                      "label_format": "pdf",

                      "generate_invoice": false,

                      "generate_packing_slip": false,

                      "courier": {

                              "posting_location": "9000257150"

                      } ,

                      "dc_service_id": "ROYALMAIL-CRL1-P",

                      "collection_date": "2021-11-03T16:00:00",

                      "reference": "DC1234567890",

                      "delivery_instructions": "Leave on the porch",

                      "ship_from": {

                              "name": "John Doe",

                              "phone": "01377455180",

                              "email": "[email protected]",

                              "company_name": "Despatch Cloud Ltd",

                              "address_1": "Unit 76",

                              "address_2": "Warfield Road",

                              "address_3": "",

                              "city": "Driffield",

                              "postcode": "YO25 9QF",

                              "county": "East Yorkshire",

                              "country_iso": "GB",

                              "company_id": "",

                              "tax_id": ""

                      } ,

                      "ship_to": {

                              "name": "Jane Doe",

                              "phone": "01377455180",

                              "email": "[email protected]",

                              "company_name": "Despatch Cloud Ltd",

                              "address_1": "Unit 76",

                              "address_2": "Warfield Road",

                              "address_3": "",

                              "city": "Driffield",

                              "postcode": "YO25 9QF",

                              "county": "East Yorkshire",

                              "country_iso": "GB"

                      } ,

                      "parcels": [

                              {

                                      "dim_width": 20,

                                      "dim_height": 40,

                                      "dim_length": 40,

                                      "dim_unit": "cm",

                                      "items": [

                                              {

                                                      "description": "Test Item One",

                                                      "origin_country": "GB",

                                                      "quantity": 1,

                                                      "value": 20,

                                                      "value_currency": "GBP",

                                                      "weight": "0.6",

                                                      "weight_unit": "kg",

                                                      "sku": "TEST0001",

                                                      "hs_code": "12345"

                                              } ,

                                              {

                                                      "description": "Test Item Two",

                                                      "origin_country": "GB",

                                                      "quantity": 1,

                                                      "value": 5,

                                                      "value_currency": "GBP",

                                                      "weight": "0.4",

                                                      "weight_unit": "kg",

                                                      "sku": "TEST0002",

                                                      "hs_code": "12345"

                                              }

                                      ]

                              }

                      ]

              }

      }

    • "testing": This employs a registered auth marked with "yes" in the UI, often utilized for testing purposes. If test credentials are used, or the courier's testing URL is the target, this parameter is set to false by default.
    • "auth_company": It corresponds to the Company field registered in the UI. It acts as an identifier for the courier on your account. It's essential when managing multiple accounts with the same courier.
    • "request_id": This value is randomly generated within our playground, but you can set it as desired. This ID assists in locating requests within your CourierAPI account dashboard.
    • "format_address_default": Set to "true," this feature aids in resolving common address formatting errors within the API. However, the exact validation methods may vary among different couriers.
    • "label_size": You can select from sizes such as 6x4 or 8x4 or even consult S17 and S19 label sizes. Additional information regarding label creation, various label sizes, and more can be found in the Documentation.
    • "generate_invoice"/"generate_packing_slip": These options allow for generating a commercial invoice or a packing slip. If a 6x4 packing slip is required, you can also opt for that.
    • "dc_service_id": This pertains to the ID of the courier service preset. These presets consist of specially configured codes granting access to specific services each courier offers. For further details, you can refer to the Courier Directory document.
    • "collection_date": This represents the expected collection date of the parcel. Usually, it reflects the current date along with a timestamp.
    • "reference": Customers can set a reference when submitting a shipment request. This reference can be displayed on the label or bill. For instance, you might use the Order ID of the shipment.
    • "delivery_instructions": If the courier supports delivery instructions and you possess specific instructions from your client, you can provide them here. This customer-driven field allows you to leave directions for the delivery driver, such as "Leave on the porch" or "Deliver to my neighbor if I'm not home."
    • "country_iso": Recipient address Country ISO code. Refer to the "ISO 3166-1 alpha-2" list for clarification.
    • "company_id": Company number for Companies House (consignor), necessary for international shipments.
    • "tax_id": VAT number with issuing country, required for international shipments.
    • "eori_id": Economic Operators Registration and Identification number (EORI), typically VAT number with trailing 000s, necessary for international shipments.
    • "description": Item description, as in your inventory system or website. E.g., "Blue Monster Doll."
    • "origin_country": ISO code of where the item was initially imported; consult the "ISO 3166-1 alpha-2" list.
    • "sku": Item identifier in your inventory system, like "TOY40."
    • "hs_code": International standard codes for classifying shipped items.
  • Response Data: This section encapsulates the body of the response received from the Courier API. Here's an example of Response Data:
    • {

              "type": "PDF",

              "request_id": "329303e4a51eb6cb8b9fc159d93bef407cd7d01d",

              "tracking_codes": [

                      "280069786000801841ADF"

              ],

              "tracking_urls": [

                      "https://www.royalmail.com/track-your-item#/tracking-results/280069786000801841ADF"

              ],

              "uri": "https://storageserversam.s3.eu-west-2.amazonaws.com/courierapi/rm_Y5XdcWDihjNwQmwut1NP.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIA2GR3ABGL2AFT4WNM%2F20211103%2Feu-west-2%2Fs3%2Faws4_request&X-Amz-Date=20211103T133407Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=85a9807a3e352318920722b73cfa748176357323e1eb17fe4c93df47f3d7e40d",

              "key": "rm_Y5XdcWDihjNwQmwut1NP.pdf",

              "dc_request_id": 46411175,

              "tracking_request_id": 46411175,

              "tracking_request_hash": 1934866789,

              "label_size": "6x4",

              "courier": "RoyalMail",

              "dc_service_id": "ROYALMAIL-CRL1-P"

      }

    • "tracking_codes": The courier supplies this code for tracking purposes.
    • "tracking_urls": If used alongside the Channel API, this information can be pushed back to compatible platforms like eBay, Amazon, Shopify, and more.
    • "uri": An array of URLs the courier provides for customers to track their shipments. Not all couriers support this feature. The URI has a 1-hour expiration time.
    • "key": This is used to regenerate the PDF in case the URI expires.
    • "tracking_request_id" / "tracking_request_hash": These parameters are helpful when making the get-tracking request, which retrieves tracking updates from the Tracking API if the Tracking API supports the courier.

By thoroughly examining these sections, you can understand the data interactions between your system and the Courier API. If there's anything else you need assistance with, please don't hesitate to let us know.

Request Logs

Request Logs offer a comprehensive view of a request's journey from inception to culmination. It includes tracking how numerous requests are initiated, transmitted, and processed until the final response is obtained and presented. A window will appear when selecting a specific request, showcasing key details like Date Time, ID, Method, URL, Duration (ms), and Status (Response Code) of the API request.

Clicking the "View logs" button unveils the logs for requests flowing between the Courier API and the courier's servers, displayed as both Request Data and Response Data.

  • Request Data: This section encompasses the requests despatched from the Courier API to the courier's servers.
  • Response Data: In this section, you gain visibility into the responses received by the Courier API from the courier's servers.