Skip to main content
POST
/
api
/
external
/
employee
/
Get Employee Details - V2
curl --request POST \
  --url https://{env}.tartanhq.com/api/external/employee/ \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "encrypted_payload": "eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2R0NNIn0...."
}
'
import requests

url = "https://{env}.tartanhq.com/api/external/employee/"

payload = { "encrypted_payload": "eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2R0NNIn0...." }
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({encrypted_payload: 'eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2R0NNIn0....'})
};

fetch('https://{env}.tartanhq.com/api/external/employee/', 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://{env}.tartanhq.com/api/external/employee/",
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([
'encrypted_payload' => 'eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2R0NNIn0....'
]),
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://{env}.tartanhq.com/api/external/employee/"

payload := strings.NewReader("{\n \"encrypted_payload\": \"eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2R0NNIn0....\"\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://{env}.tartanhq.com/api/external/employee/")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"encrypted_payload\": \"eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2R0NNIn0....\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{env}.tartanhq.com/api/external/employee/")

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 \"encrypted_payload\": \"eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2R0NNIn0....\"\n}"

response = http.request(request)
puts response.read_body
{
  "requestId": "f6e80421-3901-4132-85c0-7bcdc1236ce9",
  "message": "success",
  "status_code": "success",
  "status": 200,
  "data": "eyJfdfasdfasdfasdfaIjoiQUl6YVN5QmJHc0t3bVZ6SUU5a2VnPT0iLCJkYXRhIjoiU2FtcGxlIEVuY3J5cHRlZCBTdHJpbmcifQ=="
}
{
"requestId": "6899af7d-a9cb-48cb-9875-c848932407a1",
"message": "Invalid Connection ID",
"data": null
}
{
"requestId": "96783506-9a1c-4af2-a74f-8ac6a41ca82d",
"message": "Invalid token.",
"data": null
}
{
"message": "Source Permission denied",
"data": {}
}
{
"requestId": "be2915d5-fc30-4d13-bcca-3d62aefac2a0",
"message": "Internal Server Error",
"data": null
}
For field enums, refer the employee details page.

Authorizations

Authorization
string
header
required

Create a Basic Auth token by base64-encoding username:password

Body

application/json
encrypted_payload
string
required

JWE Compact Serialization string containing a signed payload.

Encryption Flow:

  1. Construct payload using EmployeeEncryptedPayload schema
  2. Convert payload to JSON string and sign it as a JWT (JWS) using RS256 with the client’s private key (alg: RS256, typ: JWT)
  3. Encrypt the signed JWT using JWE:
  • alg: RSA-OAEP-256
  • enc: A256GCM
  • key: Tartan public key
  1. Send the result as a compact JWE string

JWE Format: <protected-header>.<encrypted-key>.<iv>.<ciphertext>.<auth-tag>

Example header:

{
"alg": "RSA-OAEP-256",
"enc": "A256GCM",
"cty": "JWT"
}

Decryption & Validation (Server-side):

  • Decrypt using Tartan private key
  • Extract signed JWT (JWS)
  • Verify signature using client public key
  • Extract and validate original payload
Example:

"eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2R0NNIn0...."

Response

Employee details retrieved successfully

requestId
string
Example:

"f6e80421-3901-4132-85c0-7bcdc1236ce9"

message
string
Example:

"success"

status_code
string
Example:

"success"

status
integer
Example:

200

data
string
Example:

"eyJfdfasdfasdfasdfaIjoiQUl6YVN5QmJHc0t3bVZ6SUU5a2VnPT0iLCJkYXRhIjoiU2FtcGxlIEVuY3J5cHRlZCBTdHJpbmcifQ=="