Skip to main content
POST
/
emails
/
{id}
/
set_primary
Marks the email address as primary email
curl --request POST \
  --url https://{tenant_id}.hanko.io/emails/{id}/set_primary \
  --cookie hanko=
import requests

url = "https://{tenant_id}.hanko.io/emails/{id}/set_primary"

headers = {"cookie": "hanko="}

response = requests.post(url, headers=headers)

print(response.text)
const options = {method: 'POST', headers: {cookie: 'hanko='}};

fetch('https://{tenant_id}.hanko.io/emails/{id}/set_primary', 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://{tenant_id}.hanko.io/emails/{id}/set_primary",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_COOKIE => "hanko=",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://{tenant_id}.hanko.io/emails/{id}/set_primary"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("cookie", "hanko=")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://{tenant_id}.hanko.io/emails/{id}/set_primary")
  .header("cookie", "hanko=")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://{tenant_id}.hanko.io/emails/{id}/set_primary")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["cookie"] = 'hanko='

response = http.request(request)
puts response.read_body
{
  "code": 400,
  "message": "Bad Request"
}
{
  "code": 401,
  "message": "Unauthorized"
}
{
  "code": 500,
  "message": "Internal Server Error"
}
Deprecated. Please use the Flow API instead. What’s the Flow API?.

Authorizations

hanko
string
cookie
required

Path Parameters

id
string<uuid4>
required

ID of the email address

Example:

"c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c"

Response

Email has been set as primary