Pre-registration API (1.0.0)

Download OpenAPI specification:Download

API for supply partners to implement to allow pre-registration information for a car rental booking to be transferred to them.

Authentication

Authenticate service account credentials and issue authorization tokens

Validate credentials and issue a login token

Validate the service account credentials the partner has provided to Rentalcars and issue a bearer token to use to authorize subsequent requests

Request Body schema: application/vnd.partner.v1+json

Updated pre-registration information

username
string

Service account username provided to Rentalcars

password
string

Service account password provided to Rentalcars

Responses

Request samples

Content type
application/vnd.partner.v1+json
{
  • "username": "rentalcars",
  • "password": "pa55word"
}

Response samples

Content type
application/json
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ3cml0ZTpwcmVyZWciLCJuYW1lIjoicmVudGFsY2FycyIsImlhdCI6MTUxNjIzOTAyMn0.bk-Eh4aOiSvgpSYaZh64emn4rCtGKknxCiQ23Vc2jZg"

Prereg

Create and updare pre-registration information related to a car rental booking

Create pre-registration information

Provide pre-registration information for a booking reference

header Parameters
Authorization
required
string
Example: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ3cml0ZTpwcmVyZWciLCJuYW1lIjoicmVudGFsY2FycyIsImlhdCI6MTUxNjIzOTAyMn0.bk-Eh4aOiSvgpSYaZh64emn4rCtGKknxCiQ23Vc2jZg
Request Body schema: application/vnd.partner.v1+json

Updated pre-registration information

reference
required
string 9 characters

Booking reference

email
required
string [ 0 .. 100 ] characters

E-mail address associated with the booking

nationality
required
string 2 characters

Nationality of the customer that made the booking (ISO 3166-1 alpha-2 code)

required
object (IdentityDocument)

Details of an identity document for the customer

required
Array of objects (Driver) non-empty [ items ]

Responses

Request samples

Content type
application/vnd.partner.v1+json
{
  • "reference": "987654321",
  • "email": "john.smith@gmail.com",
  • "nationality": "GB",
  • "identityDocument": {
    },
  • "drivers": [
    ]
}

Update pre-registration information

Update previously provided pre-registration information for a booking reference

path Parameters
bookingRef
required
string

The booking for which pre-registration information needs to be updated

header Parameters
Authorization
required
string
Example: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ3cml0ZTpwcmVyZWciLCJuYW1lIjoicmVudGFsY2FycyIsImlhdCI6MTUxNjIzOTAyMn0.bk-Eh4aOiSvgpSYaZh64emn4rCtGKknxCiQ23Vc2jZg
Request Body schema: application/vnd.partner.v1+json

Updated pre-registration information

reference
required
string 9 characters

Booking reference

email
required
string [ 0 .. 100 ] characters

E-mail address associated with the booking

nationality
required
string 2 characters

Nationality of the customer that made the booking (ISO 3166-1 alpha-2 code)

required
object (IdentityDocument)

Details of an identity document for the customer

required
Array of objects (Driver) non-empty [ items ]

Responses

Request samples

Content type
application/vnd.partner.v1+json
{
  • "reference": "987654321",
  • "email": "john.smith@gmail.com",
  • "nationality": "GB",
  • "identityDocument": {
    },
  • "drivers": [
    ]
}

Common Test Scenarios

The following requests are some common scenarios to test the behaviour of the API conforms to the specification.

200 OK - Login request

Successful requests to the /login/authenticate endpoint should return a 200 OK response status code with a response body containing a valid bearer token

Request

curl --location --request POST 'https://www.example.com/api/login/authenticate' \
--header 'Content-Type: application/json' \
--data-raw '{"username" : "rentalcars", "password": "pa55word"}' 

Example Response

"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ3cml0ZTpwcmVyZWciLCJuYW1lIjoicmVudGFsY2FycyIsImlhdCI6MTUxNjIzOTAyMn0.bk-Eh4aOiSvgpSYaZh64emn4rCtGKknxCiQ23Vc2jZg"

200 OK - Prereg - Valid request

Valid authenticated requests to the /prereg endpoint should return a 200 OK HTTP response status code

curl --location --request POST 'https://www.example.com/api/prereg' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' \
--header 'Content-Type: application/json' \
--data-raw '{
  "reference": "123456789",
  "email": "test.customer@rentalcars.com",
  "nationality": "GB",
  "identityDocument": {
    "type": "PASSPORT",
    "number": "12345678",
    "issueCountry": "GB",
    "issueDate": "2020-05-10",
    "expiryDate": "2030-05-10"
  },
  "drivers": [
    {
      "mainDriver": true,
      "firstName": "Rental",
      "lastName": "Cars",
      "birthDate": "1980-01-01",
      "phoneNumber": "441611234567",
      "address": {
        "line1": "10",
        "line2": "Downing Street",
        "city": "London",
        "state": "Greater London",
        "postalCode": "SW1A 2AA",
        "country": "GB"
      },
      "licenceDocument": {
        "number": "CARS123456R7GT",
        "issueCountry": "GB",
        "issueDate": "2020-01-01",
        "expiryDate": "2030-01-10"
      }
    }
  ]
}'  

200 OK - Prereg - License issue date is less than a year

License issue dates in certain regions are the issue dates of the physical license and not the date the customer passed their driving test.

Requests to the /prereg endpoint should return a 200 OK HTTP response status code, when the license issue date is less than a year.

curl --location --request POST 'https://www.example.com/api/prereg' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' \
--header 'Content-Type: application/json' \
--data-raw '{
  "reference": "123456789",
  "email": "test.customer@rentalcars.com",
  "nationality": "GB",
  "identityDocument": {
    "type": "PASSPORT",
    "number": "12345678",
    "issueCountry": "GB",
    "issueDate": "2020-05-10",
    "expiryDate": "2030-05-10"
  },
  "drivers": [
    {
      "mainDriver": true,
      "firstName": "Rental",
      "lastName": "Cars",
      "birthDate": "1980-01-01",
      "phoneNumber": "441611234567",
      "address": {
        "line1": "10",
        "line2": "Downing Street",
        "city": "London",
        "state": "Greater London",
        "postalCode": "SW1A 2AA",
        "country": "GB"
      },
      "licenceDocument": {
        "number": "CARS123456R7GT",
        "issueCountry": "GB",
        "issueDate": "2021-06-01",
        "expiryDate": "2030-01-10"
      }
    }
  ]
}'  

200 OK - Prereg - Driver details in non-roman characters

Some driver details, such as name, may be in non-roman characters.

Requests to the /prereg endpoint should return a 200 OK HTTP response status code, when driver details contain non-roman characters.

curl --location --request POST 'https://www.example.com/api/prereg' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' \
--header 'Content-Type: application/json' \
--data-raw '{
  "reference": "123456789",
  "email": "test.customer@rentalcars.com",
  "nationality": "GB",
  "identityDocument": {
    "type": "PASSPORT",
    "number": "12345678",
    "issueCountry": "GB",
    "issueDate": "2020-05-10",
    "expiryDate": "2030-05-10"
  },
  "drivers": [
    {
      "mainDriver": true,
      "firstName": "عبد",
      "lastName": "اللطيف",
      "birthDate": "1980-01-01",
      "phoneNumber": "441611234567",
      "address": {
        "line1": "10",
        "line2": "Downing Street",
        "city": "London",
        "state": "Greater London",
        "postalCode": "SW1A 2AA",
        "country": "GB"
      },
      "licenceDocument": {
        "number": "CARS123456R7GT",
        "issueCountry": "GB",
        "issueDate": "2020-01-01",
        "expiryDate": "2030-01-10"
      }
    }
  ]
}'  

200 OK - Prereg - Optional fields not populated

Requests to the /prereg endpoint should return a 200 OK HTTP response status code, when optional fields are empty.

curl --location --request POST 'https://www.example.com/api/prereg' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' \
--header 'Content-Type: application/json' \
--data-raw '{
  "reference": "123456789",
  "email": "test.customer@rentalcars.com",
  "nationality": "GB",
  "identityDocument": {
    "type": "PASSPORT",
    "number": "12345678",
    "issueCountry": "GB",
    "issueDate": "",
    "expiryDate": "2030-05-10"
  },
  "drivers": [
    {
      "mainDriver": true,
      "firstName": "Rental",
      "lastName": "Cars",
      "birthDate": "1980-01-01",
      "phoneNumber": "441611234567",
      "address": {
        "line1": "10 Downing Street",
        "line2": "",
        "city": "",
        "state": "",
        "postalCode": "SW1A 2AA",
        "country": "GB"
      },
      "licenceDocument": {
        "number": "CARS123456R7GT",
        "issueCountry": "GB",
        "issueDate": "2020-01-01",
        "expiryDate": "2030-01-10"
      }
    }
  ]
}'

401 Unauthorised - Prereg - Invalid Authorization header

Requests to the /prereg endpoint with a missing Authorization header, or an invalid/expired bearer token in the Authorization header should return a 401 Unauthorised HTTP response status code

curl --location --request POST 'https://www.example.com/api/prereg' \
--header 'Authorization: Bearer invalid' \
--header 'Content-Type: application/json' \
--data-raw '{
  "reference": "123456789",
  "email": "test.customer@rentalcars.com",
  "nationality": "GB",
  "identityDocument": {
    "type": "PASSPORT",
    "number": "12345678",
    "issueCountry": "GB",
    "issueDate": "2020-05-10",
    "expiryDate": "2030-05-10"
  },
  "drivers": [
    {
      "mainDriver": true,
      "firstName": "Rental",
      "lastName": "Cars",
      "birthDate": "1980-01-01",
      "phoneNumber": "441611234567",
      "address": {
        "line1": "10",
        "line2": "Downing Street",
        "city": "London",
        "state": "Greater London",
        "postalCode": "SW1A 2AA",
        "country": "GB"
      },
      "licenceDocument": {
        "number": "CARS123456R7GT",
        "issueCountry": "GB",
        "issueDate": "2020-01-01",
        "expiryDate": "2030-01-10"
      }
    }
  ]
}' 

400 Bad Request - Prereg - Invalid email format

Requests to the /prereg endpoint with an invalid email format should return a 400 Bad Request HTTP response status code

curl --location --request POST 'https://www.example.com/api/prereg' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' \
--header 'Content-Type: application/json' \
--data-raw '{
  "reference": "123456789",
  "email": "invalidemailformat.com",
  "nationality": "GB",
  "identityDocument": {
    "type": "PASSPORT",
    "number": "12345678",
    "issueCountry": "GB",
    "issueDate": "2020-05-10",
    "expiryDate": "2030-05-10"
  },
  "drivers": [
    {
      "mainDriver": true,
      "firstName": "Rental",
      "lastName": "Cars",
      "birthDate": "1980-01-01",
      "phoneNumber": "441611234567",
      "address": {
        "line1": "10",
        "line2": "Downing Street",
        "city": "London",
        "state": "Greater London",
        "postalCode": "SW1A 2AA",
        "country": "GB"
      },
      "licenceDocument": {
        "number": "CARS123456R7GT",
        "issueCountry": "GB",
        "issueDate": "2020-01-01",
        "expiryDate": "2030-01-10"
      }
    }
  ]
}'