Hide

CalDAV API Developer's Guide

Google provides a CalDAV interface that you can use to view and manage calendars using the CalDAV protocol.

Specifications

For each of the relevant specifications, Google's CalDAV support is as follows:

  • rfc4918: HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)
    • Supports the HTTP methods GET, PUT, HEAD, DELETE, POST, OPTIONS, PROPFIND and PROPPATCH.
    • Does not support the HTTP methods LOCK, UNLOCK, COPY, MOVE, or MKCOL, or the If* header (except for If-Match).
    • Does not support arbitrary (user-defined) WebDAV properties.
    • Does not support WebDAV Access Control (rfc3744).
  • rfc4791: Calendaring Extensions to WebDAV (CalDAV)
    • Supports the HTTP method REPORT. All reports except free-busy-query are implemented.
    • Does not support the HTTP method MKCALENDAR.
  • rfc5545: iCalendar
    • Data exposed in the CalDAV interface are formatted according to the iCalendar specification.
    • Does not currently support VTODO or VJOURNAL data.
  • rfc6638: Scheduling Extensions to CalDAV
    • Supports a trivial "inbox," which is always empty.
    • Invitations you receive are automatically delivered into your "events" collection rather than being placed into your "inbox."
    • Does not support free-busy lookup.
  • caldav-ctag-02: Calendar Collection Entity Tag (CTag) in CalDAV
    • The calendar ctag is like a resource etag; it changes when anything in the calendar has changed. This allows the client application to quickly determine that it does not need to synchronize any changed events.

We have not yet provided a full implementation of all of the relevant specifications, however for many clients such as Apple iCal™ the CalDAV protocol should interoperate correctly.

Note: For account security and to prevent abuse, Google might set cookies on client applications that access data via CalDAV.

Creating your client ID

To use the CalDAV API you need to have a Google Account. If you already have an account you can use, then you're all set.

Before you can send requests to the CalDAV API, you must register your client with the Google Developers Console by creating a project.

Go to the Google Developers Console. Click Create Project, enter a name and a project ID, or accept the defaults, and click Create.

The next step is to activate CalDAV API.

To activate an API for your project, do the following:

  1. Go to the Google Developers Console.
  2. Select a project, or create a new one.
  3. In the sidebar on the left, expand APIs & auth.
  4. Click APIs to view the API Library, which lists all available APIs. The APIs are grouped by product family and popularity. If the API you want to activate isn't visible in the list, then use search to find it.
  5. Select the API you want to activate, then select the Enable API button.

After you have enabled an API, use the Enabled APIs link in the Console's API section to see a list of all your enabled APIs. From the list, you can disable and re-enable an API. Some APIs prompt you to accept their Terms of Service before you can activate them.

To perform CalDAV API requests you will need Client ID and Client Secret.

To find your project's client ID and client secret, do the following:

  1. Go to the Google Developers Console.
  2. Select a project, or create a new one.
  3. In the sidebar on the left, expand APIs & auth. Next, click APIs. Select the Enabled APIs link in the API section to see a list of all your enabled APIs. Make sure that the Google Calendar API is on the list of enabled APIs. If you have not enabled it, select the API from the list of APIs, then select the Enable API button for the API.
  4. In the sidebar on the left, select Credentials.
  5. If you haven't done so already, create your project's OAuth 2.0 credentials by clicking Create new Client ID, and providing the information needed to create the credentials.
  6. Look for the Client ID and Client secret in the table associated with each of your credentials.

Note that not all types of credentials use both a client ID and client secret and won't be listed in the table if they are not used.

Connecting to Google's CalDAV server

To use the CalDAV interface, a client program initially connects with the calendar server at one of two starting points. In either case, the connection must be made over HTTPS and must use the OAuth 2.0 authentication scheme. The CalDAV server will refuse to authenticate a request unless it arrives over HTTPS with OAuth 2.0 authentication of a Google account. Attempting to connect over HTTP or using Basic Authentication results in an HTTP 401 Unauthorized status code.

If the client program (such as Apple iCal) requires a principal collection as the starting point, the URI to connect to is:

https://apidata.googleusercontent.com/caldav/v2/calid/user

Where calid should be replaced by the "calendar ID" of the calendar to be accessed. This can be found through the Google Calendar web interface as follows: in the pull-down menu next to the calendar name, select Calendar Settings. On the resulting page the calendar ID is shown in a section labelled Calendar Address. The calendar ID for a user's primary calendar is the same as that user's email address.

If a client program (such as Mozilla Sunbird) requires a calendar collection as the starting point, the URI to connect to is:

https://apidata.googleusercontent.com/caldav/v2/calid/events

The old endpoint https://www.google.com/calendar/dav is deprecated and no longer supported; use it at your own risk. We recommend you transition to the new endpoint format described above.

Contact us

You can report new bugs and feature requests on our CalDAV developer forum. Before you contact us, please, review the existing issues.

Send feedback about...

Google Calendar API