{
  "info": {
    "name": "Court Booking API v1",
    "description": "Novator Court & Facility Booking for Odoo. Set base_url to https://<venue domain>/api/booking/v1. Sign-in requests save the token automatically. Guide: https://docs.novatorapps.com/facility-booking/api",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://booking.example.com/api/booking/v1"
    },
    {
      "key": "token",
      "value": ""
    },
    {
      "key": "booking_id",
      "value": ""
    },
    {
      "key": "client_uuid",
      "value": ""
    },
    {
      "key": "identifier",
      "value": "+1 646 555 0147"
    },
    {
      "key": "date",
      "value": "2026-11-22"
    }
  ],
  "item": [
    {
      "name": "Venue",
      "item": [
        {
          "name": "Config",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/config",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "config"
              ]
            },
            "auth": {
              "type": "noauth"
            }
          }
        },
        {
          "name": "Facility types",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/facility-types",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "facility-types"
              ]
            },
            "auth": {
              "type": "noauth"
            }
          }
        },
        {
          "name": "Availability",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/availability?facility_type_id=1&date={{date}}&duration=90",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "availability"
              ],
              "query": [
                {
                  "key": "facility_type_id",
                  "value": "1"
                },
                {
                  "key": "date",
                  "value": "{{date}}"
                },
                {
                  "key": "duration",
                  "value": "90"
                }
              ]
            },
            "auth": {
              "type": "noauth"
            }
          }
        },
        {
          "name": "OpenAPI",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/openapi.json",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "openapi.json"
              ]
            },
            "auth": {
              "type": "noauth"
            }
          }
        }
      ]
    },
    {
      "name": "Sign-in",
      "item": [
        {
          "name": "Request code",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/auth/code",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "auth",
                "code"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"identifier\": \"{{identifier}}\"\n}"
            },
            "auth": {
              "type": "noauth"
            }
          }
        },
        {
          "name": "Verify code",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/auth/verify",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "auth",
                "verify"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"identifier\": \"{{identifier}}\",\n  \"code\": \"000000\",\n  \"name\": \"Test Player\",\n  \"device\": \"Postman\"\n}"
            },
            "auth": {
              "type": "noauth"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const r = pm.response.json();",
                  "if (r.data && r.data.token) { pm.collectionVariables.set('token', r.data.token); }"
                ]
              }
            }
          ]
        },
        {
          "name": "Login with password",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/auth/login",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "auth",
                "login"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"login\": \"player@example.com\",\n  \"password\": \"change-me\",\n  \"device\": \"Postman\"\n}"
            },
            "auth": {
              "type": "noauth"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const r = pm.response.json();",
                  "if (r.data && r.data.token) { pm.collectionVariables.set('token', r.data.token); }"
                ]
              }
            }
          ]
        },
        {
          "name": "Sign up with password",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/auth/signup",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "auth",
                "signup"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Test Player\",\n  \"email\": \"player@example.com\",\n  \"phone\": \"\",\n  \"password\": \"change-me-please\",\n  \"code\": \"000000\",\n  \"device\": \"Postman\"\n}"
            },
            "auth": {
              "type": "noauth"
            },
            "description": "Send \"Request code\" with the email as identifier first, then put the code from the email here."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const r = pm.response.json();",
                  "if (r.data && r.data.token) { pm.collectionVariables.set('token', r.data.token); }"
                ]
              }
            }
          ]
        },
        {
          "name": "Me",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/me",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "me"
              ]
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            }
          }
        },
        {
          "name": "Update me",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/me",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "me"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Test Player\"\n}"
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            }
          }
        },
        {
          "name": "Sign out",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/auth/logout",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "auth",
                "logout"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{}"
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Bookings",
      "item": [
        {
          "name": "Book a court",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/bookings",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "bookings"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"facility_type_id\": 1,\n  \"start\": \"{{date}} 21:00\",\n  \"duration\": 90,\n  \"players\": 4,\n  \"note\": \"\",\n  \"client_uuid\": \"{{client_uuid}}\"\n}"
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.collectionVariables.set('client_uuid', require('uuid').v4());"
                ]
              }
            },
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const r = pm.response.json();",
                  "if (r.data && r.data.id) { pm.collectionVariables.set('booking_id', r.data.id); }"
                ]
              }
            }
          ]
        },
        {
          "name": "Upcoming bookings",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/bookings?scope=upcoming",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "bookings"
              ],
              "query": [
                {
                  "key": "scope",
                  "value": "upcoming"
                }
              ]
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            }
          }
        },
        {
          "name": "Past bookings",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/bookings?scope=past",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "bookings"
              ],
              "query": [
                {
                  "key": "scope",
                  "value": "past"
                }
              ]
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            }
          }
        },
        {
          "name": "One booking",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/bookings/{{booking_id}}",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "bookings",
                "{{booking_id}}"
              ]
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            }
          }
        },
        {
          "name": "Payment link",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/bookings/{{booking_id}}/payment-link",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "bookings",
                "{{booking_id}}",
                "payment-link"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{}"
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            }
          }
        },
        {
          "name": "Cancel",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{base_url}}/bookings/{{booking_id}}/cancel",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "bookings",
                "{{booking_id}}",
                "cancel"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"reason\": \"Plans changed\"\n}"
            },
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{token}}",
                  "type": "string"
                }
              ]
            }
          }
        }
      ]
    }
  ]
}