Calendar & Contacts¶
1 endpoint for converting between vCard, ICS, and JSON.
| Method | Endpoint | Purpose |
|---|---|---|
POST |
/v1/convert/calendar |
Convert between vCard, ICS, and JSON |
Python SDK Examples¶
JSON to vCard¶
Convert a contact object to a .vcf-compatible vCard string.
from toolkitapi import Convert
cv = Convert(api_key="tk_...")
contact = {
"fn": "Jane Doe",
"email": "[email protected]",
"tel": "+1-555-234-5678",
"org": "Acme Corp",
"title": "Product Manager",
"url": "https://janedoe.toolkitapi.io",
}
result = cv.calendar(
from_format="json",
to_format="vcard",
data=contact,
)
print(result["result"])
# BEGIN:VCARD
# VERSION:3.0
# FN:Jane Doe
# EMAIL:[email protected]
# TEL:+1-555-234-5678
# ORG:Acme Corp
# TITLE:Product Manager
# URL:https://janedoe.toolkitapi.io
# END:VCARD
vCard to JSON¶
Parse a vCard string into a structured JSON object.
from toolkitapi import Convert
cv = Convert(api_key="tk_...")
vcard_text = """BEGIN:VCARD
VERSION:3.0
FN:John Smith
EMAIL:[email protected]
TEL:+1-555-100-2000
ORG:Example Ltd
END:VCARD"""
result = cv.calendar(
from_format="vcard",
to_format="json",
data=vcard_text,
)
import json
contact = json.loads(result["result"])
print(contact["fn"]) # John Smith
print(contact["email"]) # [email protected]
JSON to ICS (calendar event)¶
Generate an .ics file from a structured event object.
from toolkitapi import Convert
cv = Convert(api_key="tk_...")
event = {
"summary": "Product Launch Kickoff",
"dtstart": "20250901T090000Z",
"dtend": "20250901T100000Z",
"location": "Conference Room A",
"description": "Kickoff meeting for the Q3 product launch.",
"organizer": "[email protected]",
}
result = cv.calendar(
from_format="json",
to_format="ics",
data=event,
calendar_name="Work Events",
)
from pathlib import Path
Path("kickoff.ics").write_text(result["result"])
ICS to JSON¶
Parse an .ics file into a JSON representation.
from pathlib import Path
from toolkitapi import Convert
import json
cv = Convert(api_key="tk_...")
ics_text = Path("event.ics").read_text()
result = cv.calendar(
from_format="ics",
to_format="json",
data=ics_text,
)
event = json.loads(result["result"])
print(event["summary"])
print(event["dtstart"])
Bulk contact conversion¶
Convert a list of JSON contacts to a single vCard file with multiple entries.
from toolkitapi import Convert
cv = Convert(api_key="tk_...")
contacts = [
{"fn": "Alice Green", "email": "[email protected]"},
{"fn": "Bob Blue", "email": "[email protected]"},
{"fn": "Carol White", "email": "[email protected]"},
]
result = cv.calendar(
from_format="json",
to_format="vcard",
data=contacts,
)
from pathlib import Path
Path("contacts.vcf").write_text(result["result"])
Request Parameters¶
| Parameter | Type | Description |
|---|---|---|
from_format |
string | Source format: json, vcard, ics |
to_format |
string | Target format: json, vcard, ics |
data |
any | Contact/event data — JSON object, JSON array, or raw vCard/ICS string |
calendar_name |
string | Calendar name to embed in ICS output (optional) |
Response Fields¶
| Field | Type | Description |
|---|---|---|
result |
string | Converted output — JSON string, vCard text, or ICS text |
from_format |
string | Source format used |
to_format |
string | Target format used |
Tip
When converting JSON→vCard, data can be a single object or a list of objects. A list produces a single vCard file with multiple BEGIN:VCARD … END:VCARD blocks, which most contact apps can import in one step.