{
  "info": {
    "name": "Booka External API",
    "description": "Booka external integration API (/api/external). Import with a Staging or Production environment, then set apiKey. Docs: /docs/api",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          "// Production resolves the tenant from the host: drop X-Tenant when it is empty.",
          "if (!pm.variables.get('tenant')) { pm.request.headers.remove('X-Tenant'); }"
        ]
      }
    }
  ],
  "variable": [
    {
      "key": "venueId",
      "value": "1"
    },
    {
      "key": "spaceId",
      "value": "1"
    },
    {
      "key": "eventId",
      "value": "1"
    },
    {
      "key": "bookingId",
      "value": "1"
    }
  ],
  "item": [
    {
      "name": "Venues",
      "item": [
        {
          "name": "List venues",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/venues",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "venues"]
            }
          }
        }
      ]
    },
    {
      "name": "Spaces",
      "item": [
        {
          "name": "List spaces",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/spaces",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "spaces"]
            }
          }
        }
      ]
    },
    {
      "name": "Event Types",
      "item": [
        {
          "name": "List event types",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/event-types",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "event-types"]
            }
          }
        }
      ]
    },
    {
      "name": "Event Categories",
      "item": [
        {
          "name": "List event categories",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/event-categories",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "event-categories"]
            }
          }
        }
      ]
    },
    {
      "name": "Availability",
      "item": [
        {
          "name": "Get availability",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/availability?venue_id={{venueId}}&from=2027-04-10T00:00:00Z&to=2027-04-11T00:00:00Z",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "availability"],
              "query": [
                {
                  "key": "venue_id",
                  "value": "{{venueId}}"
                },
                {
                  "key": "from",
                  "value": "2027-04-10T00:00:00Z"
                },
                {
                  "key": "to",
                  "value": "2027-04-11T00:00:00Z"
                }
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Events",
      "item": [
        {
          "name": "List events",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/events?venue_id={{venueId}}&start_date=2027-03-01T00:00:00Z&end_date=2027-05-01T00:00:00Z&limit=100",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "events"],
              "query": [
                {
                  "key": "venue_id",
                  "value": "{{venueId}}"
                },
                {
                  "key": "start_date",
                  "value": "2027-03-01T00:00:00Z"
                },
                {
                  "key": "end_date",
                  "value": "2027-05-01T00:00:00Z"
                },
                {
                  "key": "limit",
                  "value": "100"
                }
              ]
            }
          }
        },
        {
          "name": "Get event",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/events/{{eventId}}",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "events", "{{eventId}}"]
            }
          }
        },
        {
          "name": "Create event",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/events",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "events"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"title\": \"Autumn Expo\",\n  \"description\": \"Trade expo\",\n  \"venue_ids\": [\n    1\n  ],\n  \"status\": \"enquiry\",\n  \"start_datetime\": \"2027-04-10T09:00:00Z\",\n  \"end_datetime\": \"2027-04-10T17:00:00Z\",\n  \"timezone\": \"Australia/Sydney\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const r = pm.response.json();",
                  "const id = r.data && r.data.id;",
                  "if (id !== undefined) pm.collectionVariables.set('eventId', String(id));"
                ]
              }
            }
          ]
        },
        {
          "name": "Update event",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/events/{{eventId}}",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "events", "{{eventId}}"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"status\": \"confirmed\",\n  \"title\": \"Autumn Expo 2027\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Delete event",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/events/{{eventId}}",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "events", "{{eventId}}"]
            }
          }
        }
      ]
    },
    {
      "name": "Bookings",
      "item": [
        {
          "name": "List bookings",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/bookings?venue_id={{venueId}}&from=2027-04-01&to=2027-04-30",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "bookings"],
              "query": [
                {
                  "key": "venue_id",
                  "value": "{{venueId}}"
                },
                {
                  "key": "from",
                  "value": "2027-04-01"
                },
                {
                  "key": "to",
                  "value": "2027-04-30"
                }
              ]
            }
          }
        },
        {
          "name": "Get booking",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/bookings/{{bookingId}}",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "bookings", "{{bookingId}}"]
            }
          }
        },
        {
          "name": "Create booking",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/bookings",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "bookings"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"event_id\": 1,\n  \"space_id\": 1,\n  \"start_datetime\": \"2027-04-10T09:00:00+10:00\",\n  \"end_datetime\": \"2027-04-10T17:00:00+10:00\",\n  \"timezone\": \"Australia/Sydney\",\n  \"setup_minutes\": 60,\n  \"breakdown_minutes\": 30,\n  \"status\": \"hold\",\n  \"notes\": \"Main hall for expo\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const r = pm.response.json();",
                  "const id = r.data && r.data[0] && r.data[0].id;",
                  "if (id !== undefined) pm.collectionVariables.set('bookingId', String(id));"
                ]
              }
            }
          ]
        },
        {
          "name": "Create booking (v1 body, creates the event)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/bookings",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "bookings"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"venue_id\": 1,\n  \"space_ids\": [\n    1\n  ],\n  \"start_datetime\": \"2027-05-05T09:00:00+10:00\",\n  \"end_datetime\": \"2027-05-05T11:00:00+10:00\",\n  \"status\": \"tentative\",\n  \"description\": \"Board meeting\",\n  \"external_reference\": \"CRM-77\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Update booking",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/bookings/{{bookingId}}",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "bookings", "{{bookingId}}"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"status\": \"confirmed\",\n  \"notes\": \"Updated notes\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Cancel booking",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/bookings/{{bookingId}}",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "bookings", "{{bookingId}}"]
            }
          }
        },
        {
          "name": "Bulk fetch bookings",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/bookings/bulk-fetch",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "bookings", "bulk-fetch"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"booking_ids\": [\n    1,\n    2\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Bulk update bookings",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/bookings/bulk-update",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "bookings", "bulk-update"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"booking_ids\": [\n    1,\n    2\n  ],\n  \"attributes\": {\n    \"notes\": \"Bulk note\"\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Bulk cancel bookings",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/bookings/bulk-cancel",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "bookings", "bulk-cancel"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"booking_ids\": [\n    1,\n    2\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Submit booking request",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/booking-requests",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "booking-requests"]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"venue_id\": 1,\n  \"space_id\": 1,\n  \"requested_start\": \"2027-06-01T09:00:00Z\",\n  \"requested_end\": \"2027-06-01T12:00:00Z\",\n  \"timezone\": \"Australia/Sydney\",\n  \"requester_name\": \"Sam Example\",\n  \"requester_email\": \"sam@example.com\",\n  \"party_size\": 40\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        }
      ]
    },
    {
      "name": "BMS",
      "item": [
        {
          "name": "BMS events",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/bms/events?venue_id={{venueId}}&start_date=2027-04-01T00:00:00Z&end_date=2027-05-01T00:00:00Z",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "bms", "events"],
              "query": [
                {
                  "key": "venue_id",
                  "value": "{{venueId}}"
                },
                {
                  "key": "start_date",
                  "value": "2027-04-01T00:00:00Z"
                },
                {
                  "key": "end_date",
                  "value": "2027-05-01T00:00:00Z"
                }
              ]
            }
          }
        },
        {
          "name": "BMS spaces",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/bms/spaces?venue_id={{venueId}}",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "bms", "spaces"],
              "query": [
                {
                  "key": "venue_id",
                  "value": "{{venueId}}"
                }
              ]
            }
          }
        },
        {
          "name": "BMS scenarios",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "X-API-Key",
                "value": "{{apiKey}}"
              },
              {
                "key": "X-Tenant",
                "value": "{{tenant}}",
                "description": "Staging only. Disabled in the Production environment."
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/external/bms/scenarios?venue_id={{venueId}}",
              "host": ["{{baseUrl}}"],
              "path": ["api", "external", "bms", "scenarios"],
              "query": [
                {
                  "key": "venue_id",
                  "value": "{{venueId}}"
                }
              ]
            }
          }
        }
      ]
    }
  ]
}
