Image
abstract swish line in gradient colouring from pink to blue on a dark blue background

People First API

Status codes

The table below describes the possible response codes to API requests, why the code would be returned and if it would contain an error message.

CodeMethodsMeaningMessage
200GET, PUTThe request was successful (and a resource was not created or deleted)Optional
201POST, PUTA request to create a resource was successfulOptional
202POST, PUTA request has been accepted for future processingNo
204DELETEA request to delete a resource was successfulNo
400AllThe request was not valid, it may be missing appropriate tenant headers, or it had a malformed payloadRequired
401AllAuthentication was required but was either not provided or invalidNo
403AllYou do not have access to this resourceOptional
404AllThe requested resource does not exist, or you are not authorised to access itNo
405AllThe method used is not allowedNo
409PUT, DELETEThe request was not processed because of a concurrency issue, most commonly the 'If-Match' header was required but not providedOptional
412PUT, DELETEThe request was not processed because a 'If-Match' request header condition was not met, see concurrency)Optional
500AllAn internal error occurredRequired
503AllThe API is temporarily unavailableNo

Errors

API Requests may result in an error, either due to an invalid request or because of an internal error.

When this happens the status code of the response will indicate the nature of the error and the response may contain error messages describing the error(s).

Error messages may contain the following attributes:

  • id: In the case of an internal error (500) this is a unique identifier for the exception occurrence, otherwise it's a code for the type of error.
  • text: A localised description of the error
  • object: If the source of the error is a data attribute on the request, this points to the attribute(s) (not applicable to internal errors)

See the example below showing a set of errors that have been returned from an invalid request to update the fictional insurance resource.

{
  "msg": {
    "error": [
      {
        "id": "0037INSVALIDFROM",
        "object": [
          "insurance.validFrom",
          "insurance.validTo"
        ],
        "text": "Insurance 'Valid from' must be before the 'Valid to' date"
      },
      {
        "id": "0013NOPERSON",
        "text": "The person related to this record does not exist"
      }
    ]
  },
  "meta": {
    "links": {
      "self": {
        "href": "insurance"
      }
    }
  }
}
      

Looking for something specific?