# `generate_calendar_invite` — Generate RFC 5545 Calendar Invite & Deep Links

> Part of [CalendarICS Edge API](https://calendar-ics.apikeg.com/llms.txt) (`com.apikeg/calendar-ics`)

Compiles a strict RFC 5545 / RFC 5546 .ics invite (PUBLISH, REQUEST with RSVP attendees, or CANCEL) with UTF-8 code-point-safe 75-octet CRLF folding, IANA VTIMEZONE blocks, and Google/Outlook/Yahoo/data-URI calendar links.

**Why call instead of DIY:** Eliminates multi-byte UTF-8 folding corruption, DST VTIMEZONE bugs, and Outlook CRLF rejections in <5ms for $0.001.

- **REST Endpoint:** `POST https://calendar-ics.apikeg.com/v1/generate-calendar-invite`
- **MCP Server:** `https://calendar-ics.apikeg.com/mcp` (tool: `generate_calendar_invite`)
- **Pricing:** $0.001 USD per generated .ics invite + deep-link bundle (x402 instant micropayment)
- **Free Dry-Run:** `POST https://calendar-ics.apikeg.com/v1/generate-calendar-invite?dry_run=true`

## Input JSON Schema
```json
{
  "type": "object",
  "properties": {
    "uid": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512,
      "description": "Stable globally unique event identifier. Reuse the same UID with an incremented `sequence` to update or cancel an invite."
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 500,
      "description": "Event summary/title (supports emojis, CJK, and accented characters)."
    },
    "description": {
      "type": "string",
      "maxLength": 16000,
      "description": "Plain-text meeting agenda or description."
    },
    "location": {
      "type": "string",
      "maxLength": 1000,
      "description": "Physical venue address, conference room, or virtual link."
    },
    "conferencingUrl": {
      "type": "string",
      "maxLength": 2048,
      "description": "Video meeting join URL (e.g., Zoom, Google Meet, Microsoft Teams)."
    },
    "start": {
      "type": "string",
      "minLength": 8,
      "maxLength": 64,
      "description": "Start time in ISO 8601 UTC (2026-07-15T14:00:00Z), local wall-clock ISO paired with `timezone` (2026-07-15T10:00:00), or YYYY-MM-DD for `allDay: true`."
    },
    "end": {
      "type": "string",
      "minLength": 8,
      "maxLength": 64,
      "description": "Optional end timestamp or non-inclusive end date (YYYY-MM-DD for all-day). Overrides `durationMinutes` when provided."
    },
    "durationMinutes": {
      "type": "integer",
      "minimum": 1,
      "maximum": 525600,
      "description": "Duration in minutes when `end` is omitted (defaults to 60 minutes, or 1 day for all-day events)."
    },
    "allDay": {
      "type": "boolean",
      "description": "When true, emits RFC 5545 `VALUE=DATE` (`YYYYMMDD`) all-day boundaries."
    },
    "timezone": {
      "type": "string",
      "minLength": 2,
      "maxLength": 128,
      "description": "IANA timezone identifier (e.g., \"America/New_York\", \"Europe/London\", \"Asia/Tokyo\"). Compiles an accurate RFC 5545 VTIMEZONE block and TZID-qualified timestamps."
    },
    "method": {
      "type": "string",
      "enum": [
        "PUBLISH",
        "REQUEST",
        "CANCEL"
      ],
      "default": "PUBLISH",
      "description": "iTIP method: PUBLISH (standalone event), REQUEST (RSVP meeting invite; requires `organizer`), or CANCEL (cancellation update)."
    },
    "sequence": {
      "type": "integer",
      "minimum": 0,
      "maximum": 999999,
      "description": "Revision sequence number (defaults to 0, or 1 when method is CANCEL)."
    },
    "status": {
      "type": "string",
      "enum": [
        "CONFIRMED",
        "TENTATIVE",
        "CANCELLED"
      ],
      "description": "Event status (defaults to CANCELLED when method=CANCEL, CONFIRMED otherwise)."
    },
    "organizer": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 256,
          "description": "Display name of the meeting organizer (CN)."
        },
        "email": {
          "type": "string",
          "minLength": 3,
          "maxLength": 320,
          "pattern": "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$",
          "description": "Organizer email address."
        }
      },
      "required": [
        "email"
      ],
      "additionalProperties": false,
      "description": "Calendar organizer identity (required when method is REQUEST)."
    },
    "attendees": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 256,
            "description": "Display name of the attendee (CN)."
          },
          "email": {
            "type": "string",
            "minLength": 3,
            "maxLength": 320,
            "pattern": "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$",
            "description": "Attendee email address."
          },
          "role": {
            "type": "string",
            "enum": [
              "REQ-PARTICIPANT",
              "OPT-PARTICIPANT",
              "NON-PARTICIPANT",
              "CHAIR"
            ],
            "description": "RFC 5545 participation role (defaults to REQ-PARTICIPANT)."
          },
          "rsvp": {
            "type": "boolean",
            "description": "Whether RSVP response is requested (defaults to true for METHOD:REQUEST)."
          },
          "partstat": {
            "type": "string",
            "enum": [
              "NEEDS-ACTION",
              "ACCEPTED",
              "DECLINED",
              "TENTATIVE"
            ],
            "description": "Initial participation status (defaults to NEEDS-ACTION)."
          }
        },
        "required": [
          "email"
        ],
        "additionalProperties": false
      },
      "maxItems": 200,
      "description": "List of invited participants."
    },
    "rrule": {
      "type": "string",
      "minLength": 5,
      "maxLength": 512,
      "description": "Optional RFC 5545 recurrence rule (e.g., \"FREQ=WEEKLY;BYDAY=MO,WE,FR;COUNT=12\")."
    },
    "alarmMinutesBefore": {
      "type": "integer",
      "minimum": 0,
      "maximum": 40320,
      "description": "Optional display reminder offset in minutes prior to event start (emits a VALARM block)."
    }
  },
  "required": [
    "title",
    "start"
  ],
  "additionalProperties": false
}
```

## Examples
### RSVP Meeting Invite in America/New_York
```bash
curl -X POST "https://calendar-ics.apikeg.com/v1/generate-calendar-invite" \
  -H "Content-Type: application/json" \
  -d '{"uid":"demo-sync-001@acme.io","title":"Architecture Sync 🚀","description":"Review Q3 edge latency benchmarks, rollout checklist, and SLOs.","location":"Zoom / Room 4B","conferencingUrl":"https://zoom.us/j/123456789","start":"2026-07-15T10:00:00","durationMinutes":45,"timezone":"America/New_York","method":"REQUEST","organizer":{"name":"Alice Chen","email":"alice@acme.io"},"attendees":[{"name":"Bob Patel","email":"bob@client.org","role":"REQ-PARTICIPANT","rsvp":true}],"alarmMinutesBefore":15}'
```
Expected output: Returns CRLF-folded .ics with VTIMEZONE, MIME Content-Type with method=REQUEST, filename, byteLength, and Google/Outlook365/OutlookLive/Yahoo/data-URI links.
