curl --request POST \
--url https://development.knotapi.com/zero-link/create \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "card_switcher",
"phone_number": "+12025550123",
"external_user_id": "123abc",
"card_id": "81n9al10a0ayn13"
}
'import requests
url = "https://development.knotapi.com/zero-link/create"
payload = {
"type": "card_switcher",
"phone_number": "+12025550123",
"external_user_id": "123abc",
"card_id": "81n9al10a0ayn13"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'card_switcher',
phone_number: '+12025550123',
external_user_id: '123abc',
card_id: '81n9al10a0ayn13'
})
};
fetch('https://development.knotapi.com/zero-link/create', 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://development.knotapi.com/zero-link/create",
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([
'type' => 'card_switcher',
'phone_number' => '+12025550123',
'external_user_id' => '123abc',
'card_id' => '81n9al10a0ayn13'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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://development.knotapi.com/zero-link/create"
payload := strings.NewReader("{\n \"type\": \"card_switcher\",\n \"phone_number\": \"+12025550123\",\n \"external_user_id\": \"123abc\",\n \"card_id\": \"81n9al10a0ayn13\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://development.knotapi.com/zero-link/create")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"card_switcher\",\n \"phone_number\": \"+12025550123\",\n \"external_user_id\": \"123abc\",\n \"card_id\": \"81n9al10a0ayn13\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://development.knotapi.com/zero-link/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"card_switcher\",\n \"phone_number\": \"+12025550123\",\n \"external_user_id\": \"123abc\",\n \"card_id\": \"81n9al10a0ayn13\"\n}"
response = http.request(request)
puts response.read_bodyCreate Knot Zero Link
Create a Knot Zero link for a single user.
curl --request POST \
--url https://development.knotapi.com/zero-link/create \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "card_switcher",
"phone_number": "+12025550123",
"external_user_id": "123abc",
"card_id": "81n9al10a0ayn13"
}
'import requests
url = "https://development.knotapi.com/zero-link/create"
payload = {
"type": "card_switcher",
"phone_number": "+12025550123",
"external_user_id": "123abc",
"card_id": "81n9al10a0ayn13"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'card_switcher',
phone_number: '+12025550123',
external_user_id: '123abc',
card_id: '81n9al10a0ayn13'
})
};
fetch('https://development.knotapi.com/zero-link/create', 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://development.knotapi.com/zero-link/create",
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([
'type' => 'card_switcher',
'phone_number' => '+12025550123',
'external_user_id' => '123abc',
'card_id' => '81n9al10a0ayn13'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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://development.knotapi.com/zero-link/create"
payload := strings.NewReader("{\n \"type\": \"card_switcher\",\n \"phone_number\": \"+12025550123\",\n \"external_user_id\": \"123abc\",\n \"card_id\": \"81n9al10a0ayn13\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://development.knotapi.com/zero-link/create")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"card_switcher\",\n \"phone_number\": \"+12025550123\",\n \"external_user_id\": \"123abc\",\n \"card_id\": \"81n9al10a0ayn13\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://development.knotapi.com/zero-link/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"card_switcher\",\n \"phone_number\": \"+12025550123\",\n \"external_user_id\": \"123abc\",\n \"card_id\": \"81n9al10a0ayn13\"\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password. Use your client_id as the username and your secret as the password value.
Body
The parameters to include in the user's link.
Product to associate the link with.
card_switcher "card_switcher"
User's phone number in E.164 format. Must be a valid US or Canadian phone number. Knot sends a one-time code to this number to verify the user each time they open the link.
"+12025550123"
Your unique identifier for the user.
256"123abc"
Your unique identifier for the user's card.
256"81n9al10a0ayn13"
Response
Successful request.
The Knot Zero link for the user: your base link with a unique token appended that references the user's stored parameters. Share it as a URL or encode it as a QR code. The link can be opened any number of times, with a new one-time code each time, and expires after 1 year. It stops working earlier if you create a new link for the same user and card, or revoke it.
"https://clip.knotapi.com/switch?token=example_knot_zero_token_1xxxxxxxxxxxxxxxxxx"
The unique token in link, returned separately so you don't need to parse it from the link.
"example_knot_zero_token_1xxxxxxxxxxxxxxxxxx"
Was this page helpful?