Create an enrollment link
curl --request POST \
--url https://api.usehammock.co/enrollment_links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"employee": "emp_5Tg7Rw2nBx8P",
"return_url": "<string>"
}
'import requests
url = "https://api.usehammock.co/enrollment_links"
payload = {
"employee": "emp_5Tg7Rw2nBx8P",
"return_url": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({employee: 'emp_5Tg7Rw2nBx8P', return_url: '<string>'})
};
fetch('https://api.usehammock.co/enrollment_links', 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.usehammock.co/enrollment_links",
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([
'employee' => 'emp_5Tg7Rw2nBx8P',
'return_url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.usehammock.co/enrollment_links"
payload := strings.NewReader("{\n \"employee\": \"emp_5Tg7Rw2nBx8P\",\n \"return_url\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.usehammock.co/enrollment_links")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"employee\": \"emp_5Tg7Rw2nBx8P\",\n \"return_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usehammock.co/enrollment_links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"employee\": \"emp_5Tg7Rw2nBx8P\",\n \"return_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"object": "enrollment_link",
"url": "https://app.usehammock.co/enroll/s/nl_3fP8sLm2Vc6R",
"expires_at": "2027-02-10T18:05:00Z",
"created": "2027-02-10T18:00:00Z"
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_missing",
"message": "Missing required parameter: employer.",
"param": "employer",
"doc_url": "https://docs.usehammock.co/api/errors#parameter_missing",
"request_id": "req_9Kd2Lm5nPq8R"
}
}Employees
Create an enrollment link
Returns a single-use URL that signs the employee in to Hammock’s hosted enrollment flow. The same link type is used to enroll for the first time and to change an election later.
POST
/
enrollment_links
Create an enrollment link
curl --request POST \
--url https://api.usehammock.co/enrollment_links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"employee": "emp_5Tg7Rw2nBx8P",
"return_url": "<string>"
}
'import requests
url = "https://api.usehammock.co/enrollment_links"
payload = {
"employee": "emp_5Tg7Rw2nBx8P",
"return_url": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({employee: 'emp_5Tg7Rw2nBx8P', return_url: '<string>'})
};
fetch('https://api.usehammock.co/enrollment_links', 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.usehammock.co/enrollment_links",
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([
'employee' => 'emp_5Tg7Rw2nBx8P',
'return_url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.usehammock.co/enrollment_links"
payload := strings.NewReader("{\n \"employee\": \"emp_5Tg7Rw2nBx8P\",\n \"return_url\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.usehammock.co/enrollment_links")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"employee\": \"emp_5Tg7Rw2nBx8P\",\n \"return_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usehammock.co/enrollment_links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"employee\": \"emp_5Tg7Rw2nBx8P\",\n \"return_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"object": "enrollment_link",
"url": "https://app.usehammock.co/enroll/s/nl_3fP8sLm2Vc6R",
"expires_at": "2027-02-10T18:05:00Z",
"created": "2027-02-10T18:00:00Z"
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_missing",
"message": "Missing required parameter: employer.",
"param": "employer",
"doc_url": "https://docs.usehammock.co/api/errors#parameter_missing",
"request_id": "req_9Kd2Lm5nPq8R"
}
}Authorizations
Headers
Body
application/json