Aller au contenu principal

    Your next corporate event starts with an API

    Search venues, send requests and manage quotes from a single API. Three calls send your first requests; quotes, confirmation and payment follow.

    Your API key

    Can you book a corporate event venue through an API?

    Yes. The BookAfterwork API exposes the full journey: brief parsing, venue recommendations with a deterministic score, sending requests, receiving and comparing quotes, confirmation. Bearer key authentication, idempotency, signed webhooks and an MCP server for AI agents. Free for companies, no subscription.

    • 3 calls to send requests
    • MCP server in 2 clicks
    • HMAC-signed webhooks
    • OpenAPI 3.1

    Quick start

    Send the header Authorization: Bearer (or x-api-key) with a bak_test_ or bak_live_.

    # 1. Parse the brief
    curl -X POST https://bookafterwork.com/api/public/v1/requests \
      -H "Authorization: Bearer $BAK_API_KEY" \
      -H "Idempotency-Key: req-2026-03-12-lyon-1" \
      -H "Content-Type: application/json" \
      -d '{"message":"Afterwork 35 personnes à Lyon le 12 mars, 40€ par personne"}'
    # → { "request_id": "…", "brief": { … }, "missing_fields": [ … ] }
    
    # 2. Recommend venues
    curl -X POST https://bookafterwork.com/api/public/v1/ai/recommend \
      -H "Authorization: Bearer $BAK_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"request_id":"<request_id>","limit":6}'
    # → { "results": [ { "venue_id": "…", "match_score": 87, … } ] }
    
    # 3. Send the requests
    curl -X POST https://bookafterwork.com/api/public/v1/requests/<request_id>/dispatch \
      -H "Authorization: Bearer $BAK_API_KEY" \
      -H "Idempotency-Key: dispatch-<request_id>-1" \
      -H "Content-Type: application/json" \
      -d '{"venue_ids":["<venue_id_1>","<venue_id_2>"]}'

    Main endpoints

    POST
    /api/public/v1/ai/parse-requestTurns a sentence into a structured brief (city, date, attendees, budget).
    POST
    /api/public/v1/venues/searchFiltered venue search: city, capacity, amenities, atmosphere.
    POST
    /api/public/v1/requestsCreates an event request.
    POST
    /api/public/v1/ai/recommendVenue ranking with an explained score (location, capacity, budget, availability, responsiveness).
    POST
    /api/public/v1/requests/{request_id}/dispatchSends the request to the selected venues.
    GET
    /api/public/v1/requests/{request_id}/quotesRetrieves the quotes received.
    POST
    /api/public/v1/ai/compare-quotesCompares quotes (total, price per person, best value).
    POST
    /api/public/v1/bookingsConfirms the booking.
    GET
    /api/public/v1/bookings/{booking_id}
    POST
    /api/public/v1/bookings/{booking_id}/payment

    MCP server in two clicks

    Add the URL below to your MCP-compatible client, authorize access via OAuth 2.1, and your agent gets four tools: venue search, city list, event request creation and request tracking.

    https://bookafterwork.com/.well-known/mcp.json

    Tools, schemas and setup details: event MCP server guide.

    Example: a Slack command in 20 lines

    Your teams type a sentence in Slack, the API returns three available venues with price per person.

    // Slack slash command: /afterwork 35 people Lyon March 12 €40
    const BASE = "https://bookafterwork.com/api/public/v1";
    const headers = {
      Authorization: `Bearer ${process.env.BAK_API_KEY}`,
      "Content-Type": "application/json",
    };
    
    export default async function handler(req, res) {
      const created = await fetch(`${BASE}/requests`, {
        method: "POST",
        headers: { ...headers, "Idempotency-Key": `slack-${req.body.trigger_id}` },
        body: JSON.stringify({ message: req.body.text }),
      }).then((r) => r.json());
    
      const reco = await fetch(`${BASE}/ai/recommend`, {
        method: "POST",
        headers,
        body: JSON.stringify({ request_id: created.request_id, limit: 3 }),
      }).then((r) => r.json());
    
      res.json({
        response_type: "in_channel",
        text: reco.results
          .map((v) => `${v.name} — ${v.capacity ?? "?"} pers. — score ${v.match_score}/100`)
          .join("\n"),
      });
    }

    Full walkthrough: Slack event integration.

    Quotas & security

    SHA-256 hashed keys, per-key scopes, expiry and revocation, per-key and per-IP quotas, full usage log, anti-bot protection on public routes.

    Idempotency

    Header Idempotency-Key on every write: a replay returns the original response, with no duplicate request or booking.

    Webhooks

    HMAC SHA-256 signature, retries at 1, 5, 30, 120 and 720 minutes, viewable delivery history.

    Frequently asked questions

    How do I get a BookAfterwork API key?

    Create a free account, then generate your test key (bak_test_) in one click from this page — it is active immediately. The production key (bak_live_) is issued after your use case is validated via the contact page. Keys are stored SHA-256 hashed and can be revoked or rotated at any time.

    Can an AI agent book end to end?

    Yes. The full journey is exposed: natural-language brief parsing, venue recommendations with a deterministic score, sending requests, receiving quotes, comparison and booking confirmation. AI is only used to understand the request: prices, capacities and availability always come from the database and the venues themselves.

    Is the API MCP-compatible?

    Yes. The MCP server is declared at /.well-known/mcp.json with OAuth 2.1 and exposes four tools: venue search, city list, event request creation and tracking of your requests. It plugs into a compatible client (Claude, ChatGPT, internal agents) in two clicks.

    How are idempotency and webhooks handled?

    Every write accepts an Idempotency-Key header: a replay returns the first response. Webhooks are signed (HMAC SHA-256) and retried at 1, 5, 30, 120 then 720 minutes.