• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
Ipinayo

Ipinayo

untitled-7077

Public
Like
untitled-7077
Home
Code
5
README.md
google-calendar-api.ts
H
index.ts
main.tsx
privacy-policy.html
Environment variables
Branches
1
Pull requests
Remixes
History
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
7/28/2025
Viewing readonly version of main branch: v12
View latest version
README.md

Calendar Link Generator API

A simple API that accepts event parameters and returns calendar links for both Google Calendar and Apple Calendar.

Features

  • ✅ Generate Google Calendar links
  • ✅ Generate Apple Calendar (.ics) links
  • ✅ Support for both GET and POST requests
  • ✅ Input validation and error handling
  • ✅ Documentation page at root URL

API Endpoints

GET /

Returns an HTML documentation page with usage examples and API reference.

GET /privacy-policy

Returns the privacy policy for the API service.

POST /api/calendar-link

Generate calendar links from JSON payload.

Request Body:

{ "title": "Team Meeting", "description": "Weekly team sync", "location": "Conference Room A", "startDate": "2024-01-15T10:00:00Z", "endDate": "2024-01-15T11:00:00Z", "timezone": "America/New_York" }

Required fields: title, startDate, endDate
Optional fields: description, location, timezone

GET /api/calendar-link

Generate calendar links from query parameters.

Example:

/api/calendar-link?title=Meeting&startDate=2024-01-15T10:00:00Z&endDate=2024-01-15T11:00:00Z&description=Team meeting&location=Conference Room A

Response Format

Both endpoints return the same JSON response format:

{ "success": true, "event": { "title": "Team Meeting", "description": "Weekly team sync", "location": "Conference Room A", "startDate": "2024-01-15T10:00:00Z", "endDate": "2024-01-15T11:00:00Z", "timezone": "America/New_York" }, "links": { "google": "https://calendar.google.com/calendar/render?action=TEMPLATE&text=...", "apple": "data:text/calendar;charset=utf8,..." } }

Date Format

Use ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ (e.g., 2024-01-15T10:00:00Z)

Usage

Google Calendar

Use the google link directly in a browser or as a redirect. Users will be taken to Google Calendar with the event pre-filled.

Apple Calendar

Use the apple link as a download link for an .ics file. This will work with Apple Calendar, Outlook, and other calendar applications that support the iCalendar format.

Example Usage

cURL Examples

POST request:

curl -X POST https://your-val-url.web.val.run/api/calendar-link \ -H "Content-Type: application/json" \ -d '{ "title": "Product Demo", "description": "Quarterly product demonstration", "location": "Main Conference Room", "startDate": "2024-02-20T14:00:00Z", "endDate": "2024-02-20T15:30:00Z" }'

GET request:

curl "https://your-val-url.web.val.run/api/calendar-link?title=Meeting&startDate=2024-01-15T10:00:00Z&endDate=2024-01-15T11:00:00Z"

JavaScript Example

// Using fetch API const response = await fetch('/api/calendar-link', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ title: 'Team Meeting', description: 'Weekly team sync', location: 'Conference Room A', startDate: '2024-01-15T10:00:00Z', endDate: '2024-01-15T11:00:00Z' }) }); const data = await response.json(); // Redirect to Google Calendar window.location.href = data.links.google; // Or download .ics file for Apple Calendar const link = document.createElement('a'); link.href = data.links.apple; link.download = 'event.ics'; link.click();

Error Handling

The API returns appropriate HTTP status codes and error messages:

  • 400 Bad Request - Missing required fields, invalid date format, or invalid JSON
  • 200 OK - Successful response with calendar links

Example error response:

{ "error": "Missing required fields: title, startDate, and endDate are required" }

Implementation Details

  • Built with Hono framework for fast HTTP handling
  • Generates Google Calendar URLs using the official Google Calendar URL scheme
  • Creates iCalendar (.ics) files for Apple Calendar compatibility
  • Validates input data and provides helpful error messages
  • Supports both GET and POST methods for flexibility

Privacy

This API does not store any event data you submit. All event information is processed in real-time to generate calendar links and is not saved to any database or persistent storage. See the full Privacy Policy for details.

FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.