---
agentTools:
  projectIndex: https://cargodocs-customer.readme.io/llms.txt
---

# Request/Response

Top-level overview of Request and Response objects/codes used within CargoDocs API

[block:api-header]
{
  "title": "Request Type"
}
[/block]

CargoDocs API HTTPS request support is limited to a subset of [RFC 2616](https://datatracker.ietf.org/doc/html/rfc2616) for Sandbox, UAT, and Production APIs. Here are the API method types currently available within the API.

[block:parameters]
{
  "data": {
    "h-0": "Request Type",
    "h-1": "Description",
    "0-0": "`GET`",
    "1-0": "`POST`",
    "0-1": "Most common and widely used methods within API. CargoDocs methods use GET to retrieves relevant details within the system.",
    "1-1": "Common search and set methods within CargoDocs API are handled through POST. [/parcels/${parcelId}/actions](https://cargodocs-customer.readme.io/reference/parcelsparcelidactions) is one of an example of POST."
  },
  "cols": 2,
  "rows": 2
}
[/block]

[block:api-header]
{
  "title": "Response Codes"
}
[/block]

CargoDocs uses conventional HTTP response codes to indicate the success or failure of an API request. In general:

* `200 OK` indicates a successful transaction.
* `403 Forbidden` relates to Acces Denied Config Issue.
* `401 Unauthorized` occurs when invalid credentials are provided.
* `400 Bad Request` is for invalid data passed onto the request.
* `500 Internal Server Error` occurs when anything goes wrong in CargoDocs API.
* `503 Service Unavailable` is a default HTTP response in case of a non-responsive service.

[block:callout]
{
  "type": "info",
  "title": "Response Error Object",
  "body": "A typical Error response object looks like:\n\n{\n  \"errorMessage\": \"Unauthorized user access\"\n}"
}
[/block]

[block:callout]
{
  "type": "danger",
  "body": "Our libraries raise exceptions for many reasons, such as parameters issues, authentication errors, and network unavailability. We recommend writing code that gracefully handles all possible API exceptions.",
  "title": "Graceful Error Handling"
}
[/block]

[block:callout]
{
  "type": "warning",
  "title": "Additional HTTP Response Codes",
  "body": "Other standard HTTP errors may be generated by our stack and not directly from our API. Here are the categories of possible Standard HTTP response codes.\n\n**1xx:** Communication transfer protocol-level information.\n**Informational**\n\n**2xx:** This indicates that the client's request was accepted successfully.\n**Success**\n\n**3xx:** Indicates that the client must take some additional action to complete their request.\n**Redirection**\n\n**4xx:** This category of error status codes points to the clients.\n**Client Error**\n\n**5xx:** This category of error is related to server exceptions due to internal incapability to perform the request. The user is advised to contact essCert Support.\n**Server Code**\n\nFor more information please refer [https://developer.mozilla.org/en-US/docs/Web/HTTP/Status](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)"
}
[/block]