Skip to content

Errors

Failed requests return a 4xx status and a JSON body that says what went wrong.

Status Meaning What to do
400 Bad Request The request failed validation. Fix the fields listed in the body. Don't retry unchanged.
401 Unauthorized Missing or invalid API key. See Authentication.
403 Forbidden Your account isn't enabled for that product. Contact your DIYLaw account manager.
404 Not Found Unknown order reference, product or URL. Check the reference and path.
405 Method Not Allowed Wrong HTTP method for the endpoint, e.g. POST to an options list. Use the method shown in these docs.
429 Too Many Requests Rate limit reached. Wait for the Retry-After seconds, then retry.
5xx A problem on our side. Retry GETs with backoff. For creates, see Retries. If it persists, contact DIYLaw.

400 Bad Request

Field errors

The body maps each invalid field to a list of messages. Show them to your user next to the matching inputs, or log them.

{
  "shareholder_type": "Individual",
  "firstname": "Adaeze",
  "lastname": "Obi",
  "shareholder_address": "2 Allen Avenue",
  "shareholder_country": 165,
  "shareholder_city": "Ikeja",
  "shareholder_email": "not-an-email",
  "shareholder_phone": "08012345678",
  "no_of_shares": 0,
  "is_shareholder_director": true
}
{
  "shareholder_email": [
    "Enter a valid email address."
  ],
  "no_of_shares": [
    "Ensure this value is greater than or equal to 1."
  ]
}

Some fields are required only when another field has a certain value, for example director details when is_shareholder_director is true. These are checked after the basic field checks, so fixing one set of errors can reveal the next.

Missing order reference

Steps after step 1 need ?order-ref=:

{
  "order-ref": [
    "This query parameter is required."
  ]
}

401 Unauthorized

{
  "detail": "Invalid API key."
}

All 401 messages are listed under When authentication fails.

403 Forbidden

The product exists but isn't enabled for your account:

{
  "detail": "Your account is not enabled for this product."
}

Products lists what your account can order.

404 Not Found

{
  "detail": "Order not found."
}

For safety, an order that belongs to another partner gives exactly the same response as one that doesn't exist. Using a Company Incorporation reference on a Business Name step also returns 404.

429 Too Many Requests

{
  "detail": "Request was throttled. Expected available in 12 seconds."
}

The Retry-After response header gives the wait in seconds.