Aller au contenu principal

    Book a corporate venue by API

    An API built for agents: three calls take you from a natural-language sentence to requests sent to venues. MCP server included, signed webhooks, OpenAPI 3.1 specification.

    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 for a full brief
    • 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/v1/ai/parse-request \
      -H "Authorization: Bearer $BAK_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"text":"Afterwork 35 personnes à Lyon le 12 mars, 40€ par personne"}'
    
    # 2. Recommend venues
    curl -X POST https://bookafterwork.com/api/v1/ai/recommend \
      -H "Authorization: Bearer $BAK_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"requestId":"<id>","limit":6}'
    
    # 3. Send the requests
    curl -X POST https://bookafterwork.com/api/v1/requests/<id>/dispatch \
      -H "Authorization: Bearer $BAK_API_KEY" \
      -H "Idempotency-Key: dispatch-<id>-1" \
      -H "Content-Type: application/json" \
      -d '{"venueIds":["<venue-1>","<venue-2>"]}'

    Main endpoints

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

    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
    export default async function handler(req, res) {
      const brief = await fetch("https://bookafterwork.com/api/v1/ai/parse-request", {
        method: "POST",
        headers: {
          Authorization: `Bearer ${process.env.BAK_API_KEY}`,
          "Content-Type": "application/json",
        },
        body: JSON.stringify({ text: req.body.text }),
      }).then((r) => r.json());
    
      const reco = await fetch("https://bookafterwork.com/api/v1/ai/recommend", {
        method: "POST",
        headers: {
          Authorization: `Bearer ${process.env.BAK_API_KEY}`,
          "Content-Type": "application/json",
        },
        body: JSON.stringify({ requestId: brief.requestId, limit: 3 }),
      }).then((r) => r.json());
    
      res.json({
        response_type: "in_channel",
        text: reco.recommendations
          .map((v) => `${v.name} — ${v.capacity} pers. — ${v.price_per_person}€/pers`)
          .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.