# KFC
## API key
Requests to the KFC API requires a KFC API key. This, in addition to several other API keys and endpoints, can be retrieved from the `
```
Testing across a period of 15 minutes, multiple user agents, with no cache/cookies, reveals that this API key is fairly 'static'.
A regular expression to extract the API key from this page is shown below:
```regex
(?<="API_KEY":\s\")[a-zA-Z0-9]{29}(?=\")
```
## KFC locations
The following API endpoint returns KFC locations based on a lookup string.
```
https://prod.kfcapi.com/api/v1/util/google/lookup?address=&geotype=Google
```
### Example
```bash
$ curl --compressed 'https://prod.kfcapi.com/api/v1/util/google/lookup?address=Gloucester&geotype=Google' \
-H 'codemarket: UK' \
-H 'countrycode: GB' \
-H 'x-api-key: siYAzKattmaIHSwMV9OJYtaoP8SRq'
```
```json
[
{
"description": "Gloucester, UK",
"matched_substrings": [
{
"length": 10,
"offset": 0
}
],
"place_id": "ChIJz_Lr9vv9cEgRzxnoIZabcOw",
"reference": "ChIJz_Lr9vv9cEgRzxnoIZabcOw",
"structured_formatting": {
"main_text": "Gloucester",
"main_text_matched_substrings": [
{
"length": 10,
"offset": 0
}
],
"secondary_text": "UK"
},
"terms": [
{
"offset": 0,
"value": "Gloucester"
},
{
"offset": 12,
"value": "UK"
}
],
"types": [
"locality",
"political",
"geocode"
]
},
{
"description": "Gloucestershire, UK",
"matched_substrings": [
{
"length": 10,
"offset": 0
}
],
"place_id": "ChIJvWBKlTVTcEgRYidBWWOI7Dc",
"reference": "ChIJvWBKlTVTcEgRYidBWWOI7Dc",
"structured_formatting": {
"main_text": "Gloucestershire",
"main_text_matched_substrings": [
{
"length": 10,
"offset": 0
}
],
"secondary_text": "UK"
},
"terms": [
{
"offset": 0,
"value": "Gloucestershire"
},
{
"offset": 17,
"value": "UK"
}
],
"types": [
"administrative_area_level_2",
"political",
"geocode"
]
},
{
"description": "Gloucester Road, Kensington, London, UK",
"matched_substrings": [
{
"length": 10,
"offset": 0
}
],
"place_id": "EidHbG91Y2VzdGVyIFJvYWQsIEtlbnNpbmd0b24sIExvbmRvbiwgVUsiLiosChQKEgnzHEc5XQV2SBHWVE8x6AIEjBIUChIJNxJ0UPQPdkgRXik3cFTbw-0",
"reference": "EidHbG91Y2VzdGVyIFJvYWQsIEtlbnNpbmd0b24sIExvbmRvbiwgVUsiLiosChQKEgnzHEc5XQV2SBHWVE8x6AIEjBIUChIJNxJ0UPQPdkgRXik3cFTbw-0",
"structured_formatting": {
"main_text": "Gloucester Road",
"main_text_matched_substrings": [
{
"length": 10,
"offset": 0
}
],
"secondary_text": "Kensington, London, UK"
},
"terms": [
{
"offset": 0,
"value": "Gloucester Road"
},
{
"offset": 17,
"value": "Kensington"
},
{
"offset": 29,
"value": "London"
},
{
"offset": 37,
"value": "UK"
}
],
"types": [
"route",
"geocode"
]
},
{
"description": "Gloucester Road Station, Gloucester Road, London, UK",
"matched_substrings": [
{
"length": 10,
"offset": 0
}
],
"place_id": "ChIJEVVNPV4FdkgREWjenJPqiBI",
"reference": "ChIJEVVNPV4FdkgREWjenJPqiBI",
"structured_formatting": {
"main_text": "Gloucester Road Station",
"main_text_matched_substrings": [
{
"length": 10,
"offset": 0
}
],
"secondary_text": "Gloucester Road, London, UK"
},
"terms": [
{
"offset": 0,
"value": "Gloucester Road Station"
},
{
"offset": 25,
"value": "Gloucester Road"
},
{
"offset": 42,
"value": "London"
},
{
"offset": 50,
"value": "UK"
}
],
"types": [
"premise",
"geocode"
]
},
{
"description": "Gloucester Green, Oxford, UK",
"matched_substrings": [
{
"length": 10,
"offset": 0
}
],
"place_id": "ChIJ3TUITKTGdkgRF0rXBjwx5A8",
"reference": "ChIJ3TUITKTGdkgRF0rXBjwx5A8",
"structured_formatting": {
"main_text": "Gloucester Green",
"main_text_matched_substrings": [
{
"length": 10,
"offset": 0
}
],
"secondary_text": "Oxford, UK"
},
"terms": [
{
"offset": 0,
"value": "Gloucester Green"
},
{
"offset": 18,
"value": "Oxford"
},
{
"offset": 26,
"value": "UK"
}
],
"types": [
"neighborhood",
"political",
"geocode"
]
}
]
```
## Geocode lookup
The following API endpoint returns latitude and longitude information for a given address.
```
https://prod.kfcapi.com/api/v1/util/google/geocode?address=&geotype=Google&autorefid={autorefid}
```
Valid examples for `` include:
- 'Gloucester, UK' (URL encoded: `Gloucester,%20UK`)
- 'GL1 2TG' (URL encoded: `GL1%202TG`)
### Example
```bash
$ curl --compressed 'https://prod.kfcapi.com/api/v1/util/google/geocode?address=Gloucester,%20UK&geotype=Google&autorefid={autorefid}' \
-H 'x-api-key: siYAzKattmaIHSwMV9OJYtaoP8SRq' \
-H 'codemarket: UK' \
-H 'countrycode: GB'
```
```json
{
"location": {
"lat": 51.8642449,
"lng": -2.238156
},
"countrycode": "GB",
"countryname": "United Kingdom",
"deliveryAddressObject": {
"street": "",
"posttown": "Gloucester",
"postcode": "",
"fullAddress": "Gloucester, UK"
}
}
```
## KFC locations (2)
```https://prod.kfcapi.com/api/v3/restaurants/geocode```
### Example
```bash
$ curl --compressed -X POST 'https://prod.kfcapi.com/api/v3/restaurants/geocode' \
-H 'Content-Type: application/json' \
-H 'x-api-key: siYAzKattmaIHSwMV9OJYtaoP8SRq' \
-H 'codemarket: UK' \
-H 'countrycode: GB' \
--data-raw '{"lat":51.8642,"lng":-2.2381}'
```
```json
[
{
"refid": "77064004",
"distance": 1672.74773966
},
{
"refid": "77064003",
"distance": 3875.53003224
},
{
"refid": "77064006",
"distance": 8176.30920337
},
{
"refid": "77064005",
"distance": 11071.95785298
},
{
"refid": "77064009",
"distance": 11990.77038952
},
{
"refid": "77023843",
"distance": 15495.2865017
},
{
"refid": "77064008",
"distance": 23880.31031652
},
{
"refid": "77064010",
"distance": 25976.74317347
},
{
"refid": "77010121",
"distance": 26523.97636434
},
{
"refid": "77010131",
"distance": 26587.65156733
},
{
"refid": "77103441",
"distance": 36257.46257524
},
{
"refid": "77106025",
"distance": 37969.78802345
},
{
"refid": "77103438",
"distance": 38723.14959847
},
{
"refid": "77064007",
"distance": 38815.62381749
},
{
"refid": "77098011",
"distance": 39627.43915774
}
]
```
## Restaurant details
```bash
$ curl --compressed 'https://prod.kfcapi.com/api/v3/restaurants/77064003' \
-H 'x-api-key: siYAzKattmaIHSwMV9OJYtaoP8SRq' \
-H 'codemarket: UK' \
-H 'countrycode: GB'
```
```json
{
"name": "Gloucester - Goodridge Avenue",
"street": "Goodridge Avenue",
"city": "Quedgely",
"postalcode": "GL2 5EA",
"marketCode": "UK",
"countryCode": "GB",
"geolocation": {
"longitude": -2.2731001,
"latitude": 51.8368626
},
"refid": "77064003",
"status": "available",
"judopayid": "100126184",
"region": "South West",
"storeid": "6403",
"bagtaxtype": "NONE",
"defaultEtaMin": 40,
"defaultEtaMax": 60,
"hours": [
{
"type": "Standard",
"groupId": "c3d9b5bd-b6bf-4351-97b2-3a0cbde14f47",
"startDate": null,
"endDate": null,
"thursday": {
"open": 900,
"close": 2300
},
"friday": {
"open": 900,
"close": 2300
},
"wednesday": {
"open": 900,
"close": 2300
},
"tuesday": {
"open": 900,
"close": 2300
},
"sunday": {
"open": 900,
"close": 2300
},
"monday": {
"open": 900,
"close": 2300
},
"saturday": {
"open": 900,
"close": 2300
}
},
{
"type": "Drivethru",
"groupId": "801aed17-73cc-4eb8-8dcd-1a3c8c53201d",
"startDate": null,
"endDate": null,
"monday": {
"open": 900,
"close": 100
},
"saturday": {
"open": 900,
"close": 100
},
"wednesday": {
"open": 900,
"close": 100
},
"sunday": {
"open": 900,
"close": 100
},
"thursday": {
"open": 900,
"close": 100
},
"friday": {
"open": 900,
"close": 100
},
"tuesday": {
"open": 900,
"close": 100
}
},
{
"type": "Collect",
"groupId": "a4f85c65-0250-4993-b131-60442c303255",
"startDate": null,
"endDate": null,
"wednesday": {
"open": 900,
"close": 2245
},
"tuesday": {
"open": 900,
"close": 2245
},
"sunday": {
"open": 900,
"close": 2245
},
"monday": {
"open": 900,
"close": 2245
},
"friday": {
"open": 900,
"close": 2245
},
"thursday": {
"open": 900,
"close": 2245
},
"saturday": {
"open": 900,
"close": 2245
}
},
{
"type": "Delivery",
"groupId": "d2bfcb0d-e825-4ebf-8a20-3988cc6caa1c",
"startDate": null,
"endDate": null,
"monday": {
"open": 1000,
"close": 2345
},
"sunday": {
"open": 1000,
"close": 2345
},
"friday": {
"open": 1000,
"close": 2345
},
"thursday": {
"open": 1000,
"close": 2345
},
"wednesday": {
"open": 1000,
"close": 2345
},
"tuesday": {
"open": 1000,
"close": 2345
},
"saturday": {
"open": 1000,
"close": 2345
}
},
{
"type": "Uber",
"groupId": "4200c603-d10e-4b59-9f80-a383693c817c",
"startDate": null,
"endDate": null,
"friday": {
"open": 1000,
"close": 2345
},
"wednesday": {
"open": 1000,
"close": 2345
},
"tuesday": {
"open": 1000,
"close": 2345
},
"sunday": {
"open": 1000,
"close": 2345
},
"monday": {
"open": 1000,
"close": 2345
},
"saturday": {
"open": 1000,
"close": 2345
},
"thursday": {
"open": 1000,
"close": 2345
}
},
{
"type": "Deliveroo",
"groupId": "d5b5d554-9b6e-49a0-8b9c-c1a4b318daf3",
"startDate": null,
"endDate": null,
"wednesday": {
"open": 1000,
"close": 2345
},
"tuesday": {
"open": 1000,
"close": 2345
},
"sunday": {
"open": 1000,
"close": 2345
},
"friday": {
"open": 1000,
"close": 2345
},
"thursday": {
"open": 1000,
"close": 2345
},
"monday": {
"open": 1000,
"close": 2345
},
"saturday": {
"open": 1000,
"close": 2345
}
},
{
"type": "Justeat",
"groupId": "1b27e17c-4634-4df9-97ed-a9d917b80c29",
"startDate": null,
"endDate": null,
"tuesday": {
"open": 1000,
"close": 2345
},
"sunday": {
"open": 1000,
"close": 2345
},
"friday": {
"open": 1000,
"close": 2345
},
"wednesday": {
"open": 1000,
"close": 2345
},
"monday": {
"open": 1000,
"close": 2345
},
"saturday": {
"open": 1000,
"close": 2345
},
"thursday": {
"open": 1000,
"close": 2345
}
}
],
"facilities": [
{
"name": "Drive Thru",
"imagePath": "restaurants/facilities-icons/restaurant-facilities-drive-thru.png"
},
{
"name": "Baby Changing Room",
"imagePath": "restaurants/facilities-icons/restaurant-facilities-baby-change.png"
},
{
"name": "Vegan",
"imagePath": "restaurants/facilities-icons/restaurant-facilities-vegan.png"
},
{
"name": "Mobile Ordering",
"imagePath": "restaurants/facilities-icons/restaurant-collect.png"
},
{
"name": "Zinger Popcorn",
"imagePath": "restaurants/facilities-icons/restaurant-facilities-zinger-popcorn.png"
},
{
"name": "Free Wifi",
"imagePath": "restaurants/facilities-icons/restaurant-facilities-wifi.png"
},
{
"name": "Disability Access",
"imagePath": "restaurants/facilities-icons/restaurant-facilities-disabled-access.png"
},
{
"name": "Colonel's Club",
"imagePath": "restaurants/facilities-icons/restaurant-facilities-colonels-club.png"
}
],
"orderModes": [
{
"modeType": "ClickAndCollect",
"serviceType": "Drivethru"
},
{
"modeType": "Deliveroo",
"serviceType": "TakeAway"
},
{
"modeType": "Delivery",
"serviceType": "TakeAway"
},
{
"modeType": "JustEat",
"serviceType": "TakeAway"
},
{
"modeType": "ClickAndCollect",
"serviceType": "DineIn"
},
{
"modeType": "UberEats",
"serviceType": "TakeAway"
},
{
"modeType": "ClickAndCollect",
"serviceType": "TakeAway"
}
]
}
```
## Menu
```
'https://prod.kfcapi.com/api/v3/restaurants//menu?modeType=ClickAndCollect&serviceType=TakeAway'
```
### Example
```bash
$ curl 'https://prod.kfcapi.com/api/v3/restaurants/77064003/menu?modeType=ClickAndCollect&serviceType=TakeAway' \
-H 'x-api-key: siYAzKattmaIHSwMV9OJYtaoP8SRq' \
-H 'codemarket: UK' \
-H 'countrycode: GB' \
```
```json
{
"channel": "ClickAndCollect",
"menuUrl": "https://menu-output-prod.s3.eu-west-1.amazonaws.com/77064003-ClickAndCollect.json",
"lastModifiedDate": "2023-04-01T05:04:10.000Z"
}
```