MENU navbar-image

Introduction

Welcome to our API documentation!

Authenticating requests

This API is not authenticated.

Accounts API

APIs for interacting with a TrustedLogin SaaS account, also known as a Team.

Verify Team Account.

Verifies that the settings on a Vendor's site are correct, and updates the API endpoint for this account. Upon successful verification, saves the API endpoint to the Team profile and logs the verification process. Returns the Team account details if successful or appropriate error responses for failure scenarios.

Note: New API endpoints and additional API controller actions can be found in the TeamApiController class, located at https://github.com/trustedlogin/trustedlogin-ecommerce/blob/php8-diff/app/Http/Controllers/TeamApiController.php

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/accounts/1';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-TL-TOKEN' => 'SHA-256 hash of the public key and API key for this team',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'api_endpoint' => 'https://example.com/wp-json/',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request POST \
    "https://app.trustedlogin.com/api/v1/accounts/1" \
    --header "X-TL-TOKEN: SHA-256 hash of the public key and API key for this team" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"api_endpoint\": \"https:\\/\\/example.com\\/wp-json\\/\"
}"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/accounts/1"
);

const headers = {
    "X-TL-TOKEN": "SHA-256 hash of the public key and API key for this team",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "api_endpoint": "https:\/\/example.com\/wp-json\/"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
       "id": 4,
       "name": "sdsdf",
       "status": "active",
}
 

Example response (402):


{
    "error": "true",
    "message": "You do not have a valid TrustedLogin subscription"
}
 

Example response (403):


{
    "error": "true",
    "message": "You can not access this team"
}
 

Example response (404):


{
    "error": "true",
    "message": "Team Not Found"
}
 

Example response (422):


{
    "message": "The given data was invalid.",
    "errors": {
        "api_endpoint": [
            "The api endpoint field is required."
        ]
    }
}
 

Request      

POST api/v1/accounts/{accountId}

Headers

X-TL-TOKEN        

Example: SHA-256 hash of the public key and API key for this team

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

accountId   integer     

The Account ID. Example: 1

Body Parameters

api_endpoint   string     

The URL to the Vendor's WordPress REST API Endpoint. Example: https://example.com/wp-json/

Endpoints

GET api/v1/envelope-signing-public-key

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/envelope-signing-public-key';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request GET \
    --get "https://app.trustedlogin.com/api/v1/envelope-signing-public-key" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/envelope-signing-public-key"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (404):

Show headers
cache-control: must-revalidate, no-store, private
content-type: application/json
pragma: no-cache
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
access-control-allow-origin: *
 

{
    "publicKey": null
}
 

Request      

GET api/v1/envelope-signing-public-key

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

POST api/v1/sites/{secret_id}/verify-identifier

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/sites/1/verify-identifier';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'timestamp' => 16,
            'user_agent' => 'n',
            'user_ip' => '1.102.226.211',
            'site_url' => 'http://www.bailey.biz/quos-velit-et-fugiat-sunt-nihil-accusantium-harum.html',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request POST \
    "https://app.trustedlogin.com/api/v1/sites/1/verify-identifier" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"timestamp\": 16,
    \"user_agent\": \"n\",
    \"user_ip\": \"1.102.226.211\",
    \"site_url\": \"http:\\/\\/www.bailey.biz\\/quos-velit-et-fugiat-sunt-nihil-accusantium-harum.html\"
}"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/sites/1/verify-identifier"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "timestamp": 16,
    "user_agent": "n",
    "user_ip": "1.102.226.211",
    "site_url": "http:\/\/www.bailey.biz\/quos-velit-et-fugiat-sunt-nihil-accusantium-harum.html"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/sites/{secret_id}/verify-identifier

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

secret_id   integer     

The ID of the secret. Example: 1

Body Parameters

timestamp   integer     

Example: 16

user_agent   string     

Must not be greater than 255 characters. Example: n

user_ip   string  optional    

Must be a valid IP address. Example: 1.102.226.211

site_url   string     

Example: http://www.bailey.biz/quos-velit-et-fugiat-sunt-nihil-accusantium-harum.html

Report Brute Force Attempt.

Report that someone has tripped the lockdown on a client site.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/report-brute-force';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Public Key as Bearer Token',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'timestamp' => 'architecto',
            'user_agent' => 'architecto',
            'user_ip' => 'architecto',
            'site_url' => 'https://example.com/',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request POST \
    "https://app.trustedlogin.com/api/v1/report-brute-force" \
    --header "Authorization: Public Key as Bearer Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"timestamp\": \"architecto\",
    \"user_agent\": \"architecto\",
    \"user_ip\": \"architecto\",
    \"site_url\": \"https:\\/\\/example.com\\/\"
}"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/report-brute-force"
);

const headers = {
    "Authorization": "Public Key as Bearer Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "timestamp": "architecto",
    "user_agent": "architecto",
    "user_ip": "architecto",
    "site_url": "https:\/\/example.com\/"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (204):

Empty response
 

Example response (422):


{
    "errors": {
        "identifier": [
            "The identifier field is required."
        ]
    }
}
 

Example response (500):


{
    "message": "Description of error"
}
 

Request      

POST api/v1/report-brute-force

Headers

Authorization        

Example: Public Key as Bearer Token

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

timestamp   timestamp  optional    

The timestamp when the lockdown was initiated Example: architecto

user_agent   string  optional    

The HTTP User Agent reported by the user Example: architecto

user_ip   string  optional    

The user's IP address Example: architecto

site_url   string  optional    

The URL of the site. Example: https://example.com/

POST /api/v1/sites/{secret_id}/login-attempts

Customer site reports a failed support login. Authed via CheckPublicKeyFromBearerToken; rate-limited per-secret + per-team.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/sites/1/login-attempts';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'code' => 'login_failed',
            'detailed_reason' => 'b',
            'identifier_hash' => 'ngzmiyvdljnikhwaykcmyuwpwlvqwrsitcpscqldzsnrwtujwvlxjklqppwqbewt',
            'client_site_url' => 'http://king.biz/',
            'client_user_agent' => 'q',
            'client_ip' => '1.102.226.211',
            'attempted_at' => '2022-08-28',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request POST \
    "https://app.trustedlogin.com/api/v1/sites/1/login-attempts" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"code\": \"login_failed\",
    \"detailed_reason\": \"b\",
    \"identifier_hash\": \"ngzmiyvdljnikhwaykcmyuwpwlvqwrsitcpscqldzsnrwtujwvlxjklqppwqbewt\",
    \"client_site_url\": \"http:\\/\\/king.biz\\/\",
    \"client_user_agent\": \"q\",
    \"client_ip\": \"1.102.226.211\",
    \"attempted_at\": \"2022-08-28\"
}"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/sites/1/login-attempts"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "code": "login_failed",
    "detailed_reason": "b",
    "identifier_hash": "ngzmiyvdljnikhwaykcmyuwpwlvqwrsitcpscqldzsnrwtujwvlxjklqppwqbewt",
    "client_site_url": "http:\/\/king.biz\/",
    "client_user_agent": "q",
    "client_ip": "1.102.226.211",
    "attempted_at": "2022-08-28"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/sites/{secret_id}/login-attempts

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

secret_id   integer     

The ID of the secret. Example: 1

Body Parameters

code   string     

Example: login_failed

Must be one of:
  • security_check_failed
  • login_failed
  • endpoint_mismatch
  • secret_id_unknown
detailed_reason   string  optional    

Must not be greater than 4096 characters. Example: b

identifier_hash   string  optional    

Must match the regex /^[a-f0-9]{64}$/. Must be 64 characters. Example: ngzmiyvdljnikhwaykcmyuwpwlvqwrsitcpscqldzsnrwtujwvlxjklqppwqbewt

client_site_url   string     

Must be a valid URL. Must match the regex /^https?:\/\//i. Must not be greater than 2048 characters. Example: http://king.biz/

client_user_agent   string  optional    

Must not be greater than 512 characters. Example: q

client_ip   string  optional    

Must be a valid IP address. Example: 1.102.226.211

attempted_at   string     

Must be a valid date. Must be a date before +1 hour. Example: 2022-08-28

GET api/v1/logs/logins/{teamId}

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/logs/logins/architecto';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request GET \
    --get "https://app.trustedlogin.com/api/v1/logs/logins/architecto" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/logs/logins/architecto"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 58
access-control-allow-origin: *
 

{
    "message": "Unauthenticated"
}
 

Request      

GET api/v1/logs/logins/{teamId}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

teamId   string     

Example: architecto

GET api/v1/logs/logins/{teamId}/site/{siteId}

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/logs/logins/architecto/site/1';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request GET \
    --get "https://app.trustedlogin.com/api/v1/logs/logins/architecto/site/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/logs/logins/architecto/site/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 57
access-control-allow-origin: *
 

{
    "message": "Unauthenticated"
}
 

Request      

GET api/v1/logs/logins/{teamId}/site/{siteId}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

teamId   string     

Example: architecto

siteId   integer     

Example: 1

GET /api/v1/logs/login-attempts/{teamId}/{attemptId}

Connector fetches one attempt. Authed via CheckApiKey (api_key in body or query). Returns 404 (not 403) on cross-team requests so we never confirm existence.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/logs/login-attempts/architecto/architecto';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request GET \
    --get "https://app.trustedlogin.com/api/v1/logs/login-attempts/architecto/architecto" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/logs/login-attempts/architecto/architecto"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 56
access-control-allow-origin: *
 

{
    "message": "Unauthenticated"
}
 

Request      

GET api/v1/logs/login-attempts/{teamId}/{attemptId}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

teamId   string     

Example: architecto

attemptId   string     

Example: architecto

GET /api/v1/logs/login-attempts/{teamId}

Paginated list of team attempts, newest-first. Same auth as /logs/logins/{teamId}. per_page clamped to [1, 200], default 50.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/logs/login-attempts/architecto';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request GET \
    --get "https://app.trustedlogin.com/api/v1/logs/login-attempts/architecto" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/logs/login-attempts/architecto"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 55
access-control-allow-origin: *
 

{
    "message": "Unauthenticated"
}
 

Request      

GET api/v1/logs/login-attempts/{teamId}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

teamId   string     

Example: architecto

Create connection tokens for all accounts a user has Returns one token foreach __owned__ teams

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/token';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request POST \
    "https://app.trustedlogin.com/api/v1/token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/token"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/v1/token

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Exchanges a token for one team, for all of the keys needed for that team by vendor plugin

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/token/exchange';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'token' => 'architecto',
            'accountToken' => 'architecto',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request POST \
    "https://app.trustedlogin.com/api/v1/token/exchange" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"token\": \"architecto\",
    \"accountToken\": \"architecto\"
}"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/token/exchange"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "token": "architecto",
    "accountToken": "architecto"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/token/exchange

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

token   string     

Example: architecto

accountToken   string     

Example: architecto

PUT api/v1/teams

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/teams';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request PUT \
    "https://app.trustedlogin.com/api/v1/teams" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/teams"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "PUT",
    headers,
}).then(response => response.json());

Request      

PUT api/v1/teams

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

POST api/v1/teams/{id}

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/teams/1';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request POST \
    "https://app.trustedlogin.com/api/v1/teams/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/teams/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/v1/teams/{id}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

The ID of the team. Example: 1

DELETE api/v1/teams/{team_id}

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/teams/1';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request DELETE \
    "https://app.trustedlogin.com/api/v1/teams/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/teams/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Request      

DELETE api/v1/teams/{team_id}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

team_id   integer     

The ID of the team. Example: 1

POST api/v1/teams/{team_id}/pause

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/teams/1/pause';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request POST \
    "https://app.trustedlogin.com/api/v1/teams/1/pause" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/teams/1/pause"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/v1/teams/{team_id}/pause

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

team_id   integer     

The ID of the team. Example: 1

GET api/v1/teams/{team_id}

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/teams/1';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request GET \
    --get "https://app.trustedlogin.com/api/v1/teams/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/teams/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated"
}
 

Request      

GET api/v1/teams/{team_id}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

team_id   integer     

The ID of the team. Example: 1

Get team members.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/teams/1/members';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request GET \
    --get "https://app.trustedlogin.com/api/v1/teams/1/members" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/teams/1/members"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "message": "Unauthenticated"
}
 

Request      

GET api/v1/teams/{team_id}/members

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

team_id   integer     

The ID of the team. Example: 1

POST api/v1/teams/{team_id}/members

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/teams/1/members';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'email' => 'gbailey@example.net',
            'role' => 'architecto',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request POST \
    "https://app.trustedlogin.com/api/v1/teams/1/members" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"email\": \"gbailey@example.net\",
    \"role\": \"architecto\"
}"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/teams/1/members"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "gbailey@example.net",
    "role": "architecto"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/teams/{team_id}/members

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

team_id   integer     

The ID of the team. Example: 1

Body Parameters

email   string     

Must be a valid email address. Example: gbailey@example.net

role   string     

Example: architecto

DELETE api/v1/teams/{team_id}/members/{user_id}

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/teams/1/members/1';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request DELETE \
    "https://app.trustedlogin.com/api/v1/teams/1/members/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/teams/1/members/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Request      

DELETE api/v1/teams/{team_id}/members/{user_id}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

team_id   integer     

The ID of the team. Example: 1

user_id   integer     

The ID of the user. Example: 1

Cycle team keys.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/teams/1/cycle-keys';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request POST \
    "https://app.trustedlogin.com/api/v1/teams/1/cycle-keys" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/teams/1/cycle-keys"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/v1/teams/{team_id}/cycle-keys

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

team_id   integer     

The ID of the team. Example: 1

Change team member role.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/teams/1/members/1/change-role';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request POST \
    "https://app.trustedlogin.com/api/v1/teams/1/members/1/change-role" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/teams/1/members/1/change-role"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/v1/teams/{team_id}/members/{user_id}/change-role

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

team_id   integer     

The ID of the team. Example: 1

user_id   integer     

The ID of the user. Example: 1

Update user name or email

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/users';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request POST \
    "https://app.trustedlogin.com/api/v1/users" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/users"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/v1/users

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Delete user.

Also delete all teams user owns

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/users';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request DELETE \
    "https://app.trustedlogin.com/api/v1/users" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/users"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Request      

DELETE api/v1/users

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Create user and a team for them.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/users';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request PUT \
    "https://app.trustedlogin.com/api/v1/users" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/users"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "PUT",
    headers,
}).then(response => response.json());

Request      

PUT api/v1/users

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

GET api/v1/logout/remote

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/logout/remote';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request GET \
    --get "https://app.trustedlogin.com/api/v1/logout/remote" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/logout/remote"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (500):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 54
access-control-allow-origin: *
 

{
    "message": "Failed to clear remote tokens"
}
 

Request      

GET api/v1/logout/remote

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

Sites API

The Site API is the interface between the Vendor and Client plugins, the SaaS, and the Vault.

POST api/v1/accounts/{accountId}/support-url

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/accounts/architecto/support-url';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'reason' => 'architecto',
            'meta_data' => '["architecto","architecto"]',
            'team' => 16,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request POST \
    "https://app.trustedlogin.com/api/v1/accounts/architecto/support-url" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"reason\": \"architecto\",
    \"meta_data\": \"[\\\"architecto\\\",\\\"architecto\\\"]\",
    \"team\": 16
}"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/accounts/architecto/support-url"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "reason": "architecto",
    "meta_data": "[\"architecto\",\"architecto\"]",
    "team": 16
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/accounts/{accountId}/support-url

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

accountId   string     

Example: architecto

Body Parameters

reason   string     

Example: architecto

meta_data   string  optional    

Must be a valid JSON string. Example: ["architecto","architecto"]

team   integer  optional    

Example: 16

Create a site.

Adds a site to the SaaS and the Vault, associated with the vendor

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/sites';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Public Key as Bearer Token',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'accessKey' => '69a41a5d53dd23ae',
            'secretId' => 'architecto',
            'siteUrl' => 'https://example.com/',
            'identifier' => 'architecto',
            'team' => 1,
            'nonce' => 'architecto',
            'clientPublicKey' => 'architecto',
            'version' => 'architecto',
            'wpUserId' => 16,
            'expiresAt' => 16,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request POST \
    "https://app.trustedlogin.com/api/v1/sites" \
    --header "Authorization: Public Key as Bearer Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"accessKey\": \"69a41a5d53dd23ae\",
    \"secretId\": \"architecto\",
    \"siteUrl\": \"https:\\/\\/example.com\\/\",
    \"identifier\": \"architecto\",
    \"team\": 1,
    \"nonce\": \"architecto\",
    \"clientPublicKey\": \"architecto\",
    \"version\": \"architecto\",
    \"wpUserId\": 16,
    \"expiresAt\": 16
}"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/sites"
);

const headers = {
    "Authorization": "Public Key as Bearer Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "accessKey": "69a41a5d53dd23ae",
    "secretId": "architecto",
    "siteUrl": "https:\/\/example.com\/",
    "identifier": "architecto",
    "team": 1,
    "nonce": "architecto",
    "clientPublicKey": "architecto",
    "version": "architecto",
    "wpUserId": 16,
    "expiresAt": 16
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (201):


{
    "success": true
}
 

Example response (422):


{
    "errors": {
        "identifier": [
            "The identifier field is required."
        ]
    }
}
 

Example response (500):


{
    "message": "Description of error"
}
 

Request      

POST api/v1/sites

Headers

Authorization        

Example: Public Key as Bearer Token

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

accessKey   string     

The site's license key or other customer identifier. Example: 69a41a5d53dd23ae

secretId   string     

A unique string representing the client site. Stored outside the Vault. Example: architecto

siteUrl   url  optional    

The URL of the site. Example: https://example.com/

identifier   string     

The unique string used to identify an auto-generated support account Example: architecto

team   integer     

ID of account/team. Example: 1

nonce   string     

A unique string used to validate that the request is coming from the client Example: architecto

clientPublicKey   required  optional    

The public key of the client site Example: architecto

metaData   object  optional    
version   string  optional    

The version of the application making this request Example: architecto

wpUserId   integer  optional    

The User ID of the WordPress user on the client site who made this request Example: 16

expiresAt   integer  optional    

The timestamp when this support account should expire Example: 16

Lookup Site by Access Key(s) or Hashed Licesne Keys.

Retrieve an array of sites' secretIds by querying one or more access keys or hashed license keys

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/accounts/architecto/sites';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Private Key as Bearer Token',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'searchKeys' => [
                'accessKey1',
                'accessKey2',
                'licenseKey1',
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request POST \
    "https://app.trustedlogin.com/api/v1/accounts/architecto/sites" \
    --header "Authorization: Private Key as Bearer Token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"searchKeys\": [
        \"accessKey1\",
        \"accessKey2\",
        \"licenseKey1\"
    ]
}"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/accounts/architecto/sites"
);

const headers = {
    "Authorization": "Private Key as Bearer Token",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "searchKeys": [
        "accessKey1",
        "accessKey2",
        "licenseKey1"
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
"accessKey1": [
"secretId1"
],
"accessKey2": [
"secretId2",
"secretId3"
]
"accessKey2": [
"secretId2",
"secretId3"
]
}
 

Example response (204, No sites):

Empty response
 

Example response (400, no access key provided):


{
    "message": "Missing searchKeys parameter in body"
}
 

Example response (400, access key provided, but not an array):


{
    "message": "searchKeys parameter must be an array"
}
 

Example response (401):


Unauthenticated.
 

Example response (500):


{
    "message": "Description of error"
}
 

Request      

POST api/v1/accounts/{accountId}/sites

Headers

Authorization        

Example: Private Key as Bearer Token

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

accountId   string     

Example: architecto

Body Parameters

searchKeys   string[]     

The access key(s) or hashed license keys to query

Get Site Envelope.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/sites/1/architecto/get-envelope';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Private Key as Bearer Token',
            'X-TL-TOKEN' => 'SHA-256 hash of the public key and API key for this team',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request POST \
    "https://app.trustedlogin.com/api/v1/sites/1/architecto/get-envelope" \
    --header "Authorization: Private Key as Bearer Token" \
    --header "X-TL-TOKEN: SHA-256 hash of the public key and API key for this team" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/sites/1/architecto/get-envelope"
);

const headers = {
    "Authorization": "Private Key as Bearer Token",
    "X-TL-TOKEN": "SHA-256 hash of the public key and API key for this team",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Example response (401, Invalid Authorization header):


Unauthenticated.
 

Example response (401, Invalid X-TL-TOKEN header):


Unauthenticated.
 

Example response (401, Invalid nonce):


Invalid signature - identity of vendor not validate
 

Example response (404, Unable to verify team):



 

Example response (500):


{
    "message": "Description of error"
}
 

Request      

POST api/v1/sites/{accountId}/{secret_id}/get-envelope

Headers

Authorization        

Example: Private Key as Bearer Token

X-TL-TOKEN        

Example: SHA-256 hash of the public key and API key for this team

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

accountId   integer     

Example: 1

secret_id   string     

The ID of the secret. Example: architecto

Delete a site.

The url param secretId is the secretId the client used to create the site

DELETE /api/sites/<secretId>

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://app.trustedlogin.com/api/v1/sites/architecto';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
curl --request DELETE \
    "https://app.trustedlogin.com/api/v1/sites/architecto" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://app.trustedlogin.com/api/v1/sites/architecto"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Example response (200):


{
    "deleted": "false"
}
 

Example response (201):


{
    "deleted": "true"
}
 

Example response (404):


{
    "message": "Site not found"
}
 

Request      

DELETE api/v1/sites/{secretId}

Headers

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

secretId   string  optional    

optional. Token used to claim site and delete it. Example: architecto