curl --request POST \
--url https://app.sajn.se/api/v1/contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"firstName": "<string>",
"lastName": "<string>",
"email": "[email protected]",
"phone": "<string>",
"ssn": "<string>",
"externalId": "<string>",
"companyId": "<string>",
"companyRole": "<string>"
}
'import requests
url = "https://app.sajn.se/api/v1/contacts"
payload = {
"firstName": "<string>",
"lastName": "<string>",
"email": "[email protected]",
"phone": "<string>",
"ssn": "<string>",
"externalId": "<string>",
"companyId": "<string>",
"companyRole": "<string>"
}
headers = {
"authorization": "<authorization>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
authorization: '<authorization>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
firstName: '<string>',
lastName: '<string>',
email: '[email protected]',
phone: '<string>',
ssn: '<string>',
externalId: '<string>',
companyId: '<string>',
companyRole: '<string>'
})
};
fetch('https://app.sajn.se/api/v1/contacts', 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://app.sajn.se/api/v1/contacts",
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([
'firstName' => '<string>',
'lastName' => '<string>',
'email' => '[email protected]',
'phone' => '<string>',
'ssn' => '<string>',
'externalId' => '<string>',
'companyId' => '<string>',
'companyRole' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$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://app.sajn.se/api/v1/contacts"
payload := strings.NewReader("{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"[email protected]\",\n \"phone\": \"<string>\",\n \"ssn\": \"<string>\",\n \"externalId\": \"<string>\",\n \"companyId\": \"<string>\",\n \"companyRole\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
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://app.sajn.se/api/v1/contacts")
.header("authorization", "<authorization>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"[email protected]\",\n \"phone\": \"<string>\",\n \"ssn\": \"<string>\",\n \"externalId\": \"<string>\",\n \"companyId\": \"<string>\",\n \"companyRole\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.sajn.se/api/v1/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"[email protected]\",\n \"phone\": \"<string>\",\n \"ssn\": \"<string>\",\n \"externalId\": \"<string>\",\n \"companyId\": \"<string>\",\n \"companyRole\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"email": "<string>",
"phone": "<string>",
"ssn": "<string>",
"externalId": "<string>",
"companyRole": "<string>",
"company": {
"id": "<string>",
"name": "<string>",
"orgNumber": "<string>"
}
}{
"message": "<string>",
"code": "<string>",
"errorId": "<string>"
}{
"message": "<string>",
"code": "<string>",
"errorId": "<string>"
}Create a new contact
Create a new contact in your organization.
Required Fields:
firstName- Contact’s first name
Optional Fields:
lastName- Contact’s last name (omit or send an empty string for single-name contacts)email- Email addressphone- Phone number (for SMS notifications)ssn- Swedish personal number (for BankID)externalId- Your external reference ID for trackingcompanyId- Associate with existing companycompanyRole- Role within the company
curl --request POST \
--url https://app.sajn.se/api/v1/contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"firstName": "<string>",
"lastName": "<string>",
"email": "[email protected]",
"phone": "<string>",
"ssn": "<string>",
"externalId": "<string>",
"companyId": "<string>",
"companyRole": "<string>"
}
'import requests
url = "https://app.sajn.se/api/v1/contacts"
payload = {
"firstName": "<string>",
"lastName": "<string>",
"email": "[email protected]",
"phone": "<string>",
"ssn": "<string>",
"externalId": "<string>",
"companyId": "<string>",
"companyRole": "<string>"
}
headers = {
"authorization": "<authorization>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
authorization: '<authorization>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
firstName: '<string>',
lastName: '<string>',
email: '[email protected]',
phone: '<string>',
ssn: '<string>',
externalId: '<string>',
companyId: '<string>',
companyRole: '<string>'
})
};
fetch('https://app.sajn.se/api/v1/contacts', 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://app.sajn.se/api/v1/contacts",
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([
'firstName' => '<string>',
'lastName' => '<string>',
'email' => '[email protected]',
'phone' => '<string>',
'ssn' => '<string>',
'externalId' => '<string>',
'companyId' => '<string>',
'companyRole' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$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://app.sajn.se/api/v1/contacts"
payload := strings.NewReader("{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"[email protected]\",\n \"phone\": \"<string>\",\n \"ssn\": \"<string>\",\n \"externalId\": \"<string>\",\n \"companyId\": \"<string>\",\n \"companyRole\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
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://app.sajn.se/api/v1/contacts")
.header("authorization", "<authorization>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"[email protected]\",\n \"phone\": \"<string>\",\n \"ssn\": \"<string>\",\n \"externalId\": \"<string>\",\n \"companyId\": \"<string>\",\n \"companyRole\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.sajn.se/api/v1/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"[email protected]\",\n \"phone\": \"<string>\",\n \"ssn\": \"<string>\",\n \"externalId\": \"<string>\",\n \"companyId\": \"<string>\",\n \"companyRole\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"email": "<string>",
"phone": "<string>",
"ssn": "<string>",
"externalId": "<string>",
"companyRole": "<string>",
"company": {
"id": "<string>",
"name": "<string>",
"orgNumber": "<string>"
}
}{
"message": "<string>",
"code": "<string>",
"errorId": "<string>"
}{
"message": "<string>",
"code": "<string>",
"errorId": "<string>"
}Authorizations
OAuth 2.0 access token for a connected application. Limited to the scopes granted at consent.
Headers
Bearer token for API authentication
Makes retries safe. A retry with the same key and the same request replays the stored response for 24 hours (header Idempotent-Replayed: true); the same key with a different request returns 400.
255Body
Body
Create contact request
Contact first name (required)
1Contact last name (optional, e.g. for single-name contacts)
Contact email address
^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$Contact phone number
Swedish personal number (personnummer)
Your external reference ID for this contact
ID of company to associate with
Role/title within the company
Response
200
Unique contact identifier
Contact first name
Contact last name
Date and time when contact was created
Date and time when contact was last updated
Contact email address
Contact phone number
Swedish personal number (personnummer)
Your external reference ID
Role/title within the associated company
Associated company information
Show child attributes
Show child attributes
Was this page helpful?

