curl --request POST \
--url https://api.cal.com/v2/oauth-clients/{clientId}/users \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-cal-secret-key: <x-cal-secret-key>' \
--data '
{
"email": "alice@example.com",
"name": "Alice Smith",
"timeFormat": 12,
"weekStart": "Monday",
"timeZone": "America/New_York",
"locale": "en",
"avatarUrl": "https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png",
"bio": "I am a bio",
"metadata": {
"key": "value"
}
}
'import requests
url = "https://api.cal.com/v2/oauth-clients/{clientId}/users"
payload = {
"email": "alice@example.com",
"name": "Alice Smith",
"timeFormat": 12,
"weekStart": "Monday",
"timeZone": "America/New_York",
"locale": "en",
"avatarUrl": "https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png",
"bio": "I am a bio",
"metadata": { "key": "value" }
}
headers = {
"x-cal-secret-key": "<x-cal-secret-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-cal-secret-key': '<x-cal-secret-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: 'alice@example.com',
name: 'Alice Smith',
timeFormat: 12,
weekStart: 'Monday',
timeZone: 'America/New_York',
locale: 'en',
avatarUrl: 'https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png',
bio: 'I am a bio',
metadata: {key: 'value'}
})
};
fetch('https://api.cal.com/v2/oauth-clients/{clientId}/users', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cal.com/v2/oauth-clients/{clientId}/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'alice@example.com',
'name' => 'Alice Smith',
'timeFormat' => 12,
'weekStart' => 'Monday',
'timeZone' => 'America/New_York',
'locale' => 'en',
'avatarUrl' => 'https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png',
'bio' => 'I am a bio',
'metadata' => [
'key' => 'value'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-cal-secret-key: <x-cal-secret-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cal.com/v2/oauth-clients/{clientId}/users"
payload := strings.NewReader("{\n \"email\": \"alice@example.com\",\n \"name\": \"Alice Smith\",\n \"timeFormat\": 12,\n \"weekStart\": \"Monday\",\n \"timeZone\": \"America/New_York\",\n \"locale\": \"en\",\n \"avatarUrl\": \"https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png\",\n \"bio\": \"I am a bio\",\n \"metadata\": {\n \"key\": \"value\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-cal-secret-key", "<x-cal-secret-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cal.com/v2/oauth-clients/{clientId}/users")
.header("x-cal-secret-key", "<x-cal-secret-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"alice@example.com\",\n \"name\": \"Alice Smith\",\n \"timeFormat\": 12,\n \"weekStart\": \"Monday\",\n \"timeZone\": \"America/New_York\",\n \"locale\": \"en\",\n \"avatarUrl\": \"https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png\",\n \"bio\": \"I am a bio\",\n \"metadata\": {\n \"key\": \"value\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cal.com/v2/oauth-clients/{clientId}/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-cal-secret-key"] = '<x-cal-secret-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"alice@example.com\",\n \"name\": \"Alice Smith\",\n \"timeFormat\": 12,\n \"weekStart\": \"Monday\",\n \"timeZone\": \"America/New_York\",\n \"locale\": \"en\",\n \"avatarUrl\": \"https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png\",\n \"bio\": \"I am a bio\",\n \"metadata\": {\n \"key\": \"value\"\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
"user": {
"id": 1,
"email": "alice+cluo37fwd0001khkzqqynkpj3@example.com",
"username": "alice",
"name": "alice",
"bio": "bio",
"timeZone": "America/New_York",
"weekStart": "Sunday",
"createdDate": "2024-04-01T00:00:00.000Z",
"timeFormat": 12,
"defaultScheduleId": null,
"locale": "en",
"avatarUrl": "https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png",
"metadata": {
"key": "value"
}
},
"accessTokenExpiresAt": 123,
"refreshTokenExpiresAt": 123
}
}Create a managed user
curl --request POST \
--url https://api.cal.com/v2/oauth-clients/{clientId}/users \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-cal-secret-key: <x-cal-secret-key>' \
--data '
{
"email": "alice@example.com",
"name": "Alice Smith",
"timeFormat": 12,
"weekStart": "Monday",
"timeZone": "America/New_York",
"locale": "en",
"avatarUrl": "https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png",
"bio": "I am a bio",
"metadata": {
"key": "value"
}
}
'import requests
url = "https://api.cal.com/v2/oauth-clients/{clientId}/users"
payload = {
"email": "alice@example.com",
"name": "Alice Smith",
"timeFormat": 12,
"weekStart": "Monday",
"timeZone": "America/New_York",
"locale": "en",
"avatarUrl": "https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png",
"bio": "I am a bio",
"metadata": { "key": "value" }
}
headers = {
"x-cal-secret-key": "<x-cal-secret-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-cal-secret-key': '<x-cal-secret-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: 'alice@example.com',
name: 'Alice Smith',
timeFormat: 12,
weekStart: 'Monday',
timeZone: 'America/New_York',
locale: 'en',
avatarUrl: 'https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png',
bio: 'I am a bio',
metadata: {key: 'value'}
})
};
fetch('https://api.cal.com/v2/oauth-clients/{clientId}/users', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cal.com/v2/oauth-clients/{clientId}/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'alice@example.com',
'name' => 'Alice Smith',
'timeFormat' => 12,
'weekStart' => 'Monday',
'timeZone' => 'America/New_York',
'locale' => 'en',
'avatarUrl' => 'https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png',
'bio' => 'I am a bio',
'metadata' => [
'key' => 'value'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-cal-secret-key: <x-cal-secret-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cal.com/v2/oauth-clients/{clientId}/users"
payload := strings.NewReader("{\n \"email\": \"alice@example.com\",\n \"name\": \"Alice Smith\",\n \"timeFormat\": 12,\n \"weekStart\": \"Monday\",\n \"timeZone\": \"America/New_York\",\n \"locale\": \"en\",\n \"avatarUrl\": \"https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png\",\n \"bio\": \"I am a bio\",\n \"metadata\": {\n \"key\": \"value\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-cal-secret-key", "<x-cal-secret-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cal.com/v2/oauth-clients/{clientId}/users")
.header("x-cal-secret-key", "<x-cal-secret-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"alice@example.com\",\n \"name\": \"Alice Smith\",\n \"timeFormat\": 12,\n \"weekStart\": \"Monday\",\n \"timeZone\": \"America/New_York\",\n \"locale\": \"en\",\n \"avatarUrl\": \"https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png\",\n \"bio\": \"I am a bio\",\n \"metadata\": {\n \"key\": \"value\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cal.com/v2/oauth-clients/{clientId}/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-cal-secret-key"] = '<x-cal-secret-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"alice@example.com\",\n \"name\": \"Alice Smith\",\n \"timeFormat\": 12,\n \"weekStart\": \"Monday\",\n \"timeZone\": \"America/New_York\",\n \"locale\": \"en\",\n \"avatarUrl\": \"https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png\",\n \"bio\": \"I am a bio\",\n \"metadata\": {\n \"key\": \"value\"\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
"user": {
"id": 1,
"email": "alice+cluo37fwd0001khkzqqynkpj3@example.com",
"username": "alice",
"name": "alice",
"bio": "bio",
"timeZone": "America/New_York",
"weekStart": "Sunday",
"createdDate": "2024-04-01T00:00:00.000Z",
"timeFormat": 12,
"defaultScheduleId": null,
"locale": "en",
"avatarUrl": "https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png",
"metadata": {
"key": "value"
}
},
"accessTokenExpiresAt": 123,
"refreshTokenExpiresAt": 123
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
OAuth client secret key
Path Parameters
Body
"alice@example.com"
Managed user's name is used in emails
"Alice Smith"
Must be a number 12 or 24
12, 24 12
Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday "Monday"
Timezone is used to create user's default schedule from Monday to Friday from 9AM to 5PM. If it is not passed then user does not have a default schedule and it must be created manually via the /schedules endpoint. Until the schedule is created, the user can't access availability atom to set his / her availability nor booked. It will default to Europe/London if not passed.
"America/New_York"
ar, ca, de, es, eu, he, id, ja, lv, pl, ro, sr, th, vi, az, cs, el, es-419, fi, hr, it, km, nl, pt, ru, sv, tr, zh-CN, bg, da, en, et, fr, hu, iw, ko, no, pt-BR, sk, ta, uk, zh-TW, bn "en"
URL of the user's avatar image
"https://cal.com/api/avatar/2b735186-b01b-46d3-87da-019b8f61776b.png"
Bio
"I am a bio"
You can store any additional data you want here. Metadata must have at most 50 keys, each key up to 40 characters, and values up to 500 characters.
{ "key": "value" }
Was this page helpful?