Account IP Restriction API
Version: v1.0
Specification Release Notes Other versions
The IP restriction API helps you managing your account and whitelisting your IPs and subnets for higher security when using your tyntec API key.
Base URLs
IP restriction
tyntec’s IP restriction service allows you to:
- Enable or disable IP whitelisting on your account
- Add multiple IPs or even IP subnets to the whitelist
Important
Be extra careful while using this service, as it will have immediate effect and potentially block your ongoing traffic.
The current IP used for calling tyntec's API cannot be excluded from whitelisted IPs. If you need to exclude this specific IP then the API call should be done from a different IP.
Update IP whitelisting
Code samples
# You can also use wget
curl -X POST https://api.tyntec.com/account/v1/ip/restriction \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'apikey: API_KEY'
POST https://api.tyntec.com/account/v1/ip/restriction HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json
apikey: API_KEY
const inputBody = '{
"enabled": "false",
"whiteList": [
"127.0.0.1",
"10.0.0.0/8"
]
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'apikey':'API_KEY'
};
fetch('https://api.tyntec.com/account/v1/ip/restriction',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'apikey' => 'API_KEY'
}
result = RestClient.post 'https://api.tyntec.com/account/v1/ip/restriction',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'apikey': 'API_KEY'
}
r = requests.post('https://api.tyntec.com/account/v1/ip/restriction', params={
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'apikey' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.tyntec.com/account/v1/ip/restriction', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.tyntec.com/account/v1/ip/restriction");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apikey", "API_KEY");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"apikey": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.tyntec.com/account/v1/ip/restriction", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /account/v1/ip/restriction
Modifies the IP whitelisting or this account. The operation is idempotent and will override the list of IPs and ranges that already exist.
Body parameter
{
"enabled": "false",
"whiteList": [
"127.0.0.1",
"10.0.0.0/8"
]
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | IpRestrictionEntity | true | IP restriction whitelist |
Example responses
200 Response
{
"enabled": "false",
"whiteList": [
"127.0.0.1",
"10.0.0.0/8"
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | The IP whitelist as modified by this request. | IpRestrictionEntity |
400 | Bad Request | Invalid request | Problem |
401 | Unauthorized | Unauthorized | Problem |
403 | Forbidden | Forbidden | Problem |
500 | Internal Server Error | Something went wrong. :-( | Problem |
Get IP whitelisting
Code samples
# You can also use wget
curl -X GET https://api.tyntec.com/account/v1/ip/restriction \
-H 'Accept: application/json' \
-H 'apikey: API_KEY'
GET https://api.tyntec.com/account/v1/ip/restriction HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apikey: API_KEY
const headers = {
'Accept':'application/json',
'apikey':'API_KEY'
};
fetch('https://api.tyntec.com/account/v1/ip/restriction',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'apikey' => 'API_KEY'
}
result = RestClient.get 'https://api.tyntec.com/account/v1/ip/restriction',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'apikey': 'API_KEY'
}
r = requests.get('https://api.tyntec.com/account/v1/ip/restriction', params={
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'apikey' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.tyntec.com/account/v1/ip/restriction', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.tyntec.com/account/v1/ip/restriction");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apikey", "API_KEY");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"apikey": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.tyntec.com/account/v1/ip/restriction", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /account/v1/ip/restriction
Returns the current state of the IP whitelisting for this account.
Example responses
200 Response
{
"enabled": "false",
"whiteList": [
"127.0.0.1",
"10.0.0.0/8"
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | The IP whitelist as modified by this request. | IpRestrictionEntity |
400 | Bad Request | Invalid request | Problem |
401 | Unauthorized | Unauthorized | Problem |
403 | Forbidden | Forbidden | Problem |
500 | Internal Server Error | Something went wrong. :-( | Problem |
Schemas
IpRestrictionEntity
{
"enabled": "false",
"whiteList": [
"127.0.0.1",
"10.0.0.0/8"
]
}
The IP whitelist schema.
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
enabled | boolean | true | none | Whitelisting restriction is enabled or not for this account |
whiteList | [string] | true | none | List of IPs and/or subnets that are allowed to use this account. |
Problem
{
"type": "https://docs.tyntec.com/problems/DataNotParseable",
"title": "The given data were not parsable.",
"status": 400,
"detail": "Unexpected end-of-input: expected close marker for Object (start marker at [Source: UNKNOWN; line: -1, column: -1) at [Source: UNKNOWN; line: 1, column: 97]\n"
}
The problem object follows RFC-7807.
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
type | string | false | none | The URI reference [RFC3986] that identifies the problem type |
title | string | false | none | Short, human-readable summary of the problem type |
status | number | false | none | The HTTP status code (RFC7231, Section 6) generated by the origin server for this occurrence of the problem |
detail | string | false | none | Human-readable explanation specific to this problem occurrence |
Account Keys API
Version: v1.0
Specification Release Notes Other versions
The keys API helps you managing your account API keys. You can add a secondary key for your account and delete the old one. With this mechanism you can safely rotate a key, on runtime, to keep your account safe.
Base URLs
Account keys
tyntec’s account keys service allow you to:
- Add a secondary authentication token key on your account. Both keys (old and new) will be valid and active.
- You can delete the old key once your new key is replaced at your systems.
Important
You can not delete the key you are using for this API call.
Once a key is deleted, this will have immediate effect and no recovery is possible.
List keys available
Code samples
# You can also use wget
curl -X GET https://api.tyntec.com/account/v1/keys \
-H 'Accept: application/json' \
-H 'apikey: API_KEY'
GET https://api.tyntec.com/account/v1/keys HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apikey: API_KEY
const headers = {
'Accept':'application/json',
'apikey':'API_KEY'
};
fetch('https://api.tyntec.com/account/v1/keys',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'apikey' => 'API_KEY'
}
result = RestClient.get 'https://api.tyntec.com/account/v1/keys',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'apikey': 'API_KEY'
}
r = requests.get('https://api.tyntec.com/account/v1/keys', params={
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'apikey' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.tyntec.com/account/v1/keys', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.tyntec.com/account/v1/keys");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apikey", "API_KEY");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"apikey": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://api.tyntec.com/account/v1/keys", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /account/v1/keys
Returns the api keys available for this account.
Example responses
200 Response
{
"apiKeys": "[\n {\n \"id\": \"deadbeef-b111-111f-8c6e-05f1fd3f825c\",\n \"key\": \"ABCDEFG1234567890ABCDEFG1234567890\"\n }\n] \n"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | The keys that are available for your account. | ApiKeyResponse |
400 | Bad Request | Invalid request | Problem |
401 | Unauthorized | Unauthorized | Problem |
403 | Forbidden | Forbidden | Problem |
500 | Internal Server Error | Something went wrong. :-( | Problem |
Create a secondary key
Code samples
# You can also use wget
curl -X POST https://api.tyntec.com/account/v1/keys \
-H 'Accept: application/json' \
-H 'apikey: API_KEY'
POST https://api.tyntec.com/account/v1/keys HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apikey: API_KEY
const headers = {
'Accept':'application/json',
'apikey':'API_KEY'
};
fetch('https://api.tyntec.com/account/v1/keys',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'apikey' => 'API_KEY'
}
result = RestClient.post 'https://api.tyntec.com/account/v1/keys',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'apikey': 'API_KEY'
}
r = requests.post('https://api.tyntec.com/account/v1/keys', params={
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'apikey' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.tyntec.com/account/v1/keys', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.tyntec.com/account/v1/keys");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apikey", "API_KEY");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"apikey": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://api.tyntec.com/account/v1/keys", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /account/v1/keys
Creates a secondary key for this account that will be active in parallel with the old one. No more than two keys are allowed to exist per account.
Example responses
200 Response
{
"apiKeys": "[\n {\n \"id\": \"deadbeef-b111-111f-8c6e-05f1fd3f825c\",\n \"key\": \"ABCDEFG1234567890ABCDEFG1234567890\"\n }\n] \n"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | The keys that are available for your account. | ApiKeyResponse |
400 | Bad Request | Invalid request | Problem |
401 | Unauthorized | Unauthorized | Problem |
403 | Forbidden | Forbidden | Problem |
500 | Internal Server Error | Something went wrong. :-( | Problem |
Delete an API key.
Code samples
# You can also use wget
curl -X DELETE https://api.tyntec.com/account/v1/keys \
-H 'Accept: application/json' \
-H 'apikey: API_KEY'
DELETE https://api.tyntec.com/account/v1/keys HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apikey: API_KEY
const headers = {
'Accept':'application/json',
'apikey':'API_KEY'
};
fetch('https://api.tyntec.com/account/v1/keys',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'apikey' => 'API_KEY'
}
result = RestClient.delete 'https://api.tyntec.com/account/v1/keys',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'apikey': 'API_KEY'
}
r = requests.delete('https://api.tyntec.com/account/v1/keys', params={
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'apikey' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('DELETE','https://api.tyntec.com/account/v1/keys', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://api.tyntec.com/account/v1/keys");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apikey", "API_KEY");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"apikey": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://api.tyntec.com/account/v1/keys", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
DELETE /account/v1/keys
Returns available keys for this account. You can not delete the key used for this request.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
deleteApiKey | query | string | false | The api key token value to be deleted. |
deleteApiKeyId | query | string(uuid) | false | The api key ID token value to be deleted. |
Example responses
200 Response
{
"apiKeys": "[\n {\n \"id\": \"deadbeef-b111-111f-8c6e-05f1fd3f825c\",\n \"key\": \"ABCDEFG1234567890ABCDEFG1234567890\"\n }\n] \n"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | The API key was deleted. | ApiKeyResponse |
400 | Bad Request | Invalid request | Problem |
401 | Unauthorized | Unauthorized | Problem |
403 | Forbidden | Forbidden | Problem |
500 | Internal Server Error | Something went wrong. :-( | Problem |
Schemas
ApiKeyResponse
{
"apiKeys": "[\n {\n \"id\": \"deadbeef-b111-111f-8c6e-05f1fd3f825c\",\n \"key\": \"ABCDEFG1234567890ABCDEFG1234567890\"\n }\n] \n"
}
The keys that are active for this account.
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
apiKeys | [any] | false | none | If the whitelist restriction is enabled or not for this account. |
» id | string(uuid) | false | none | The ID of the key |
» key | string | false | none | The authentication token |
Problem
{
"type": "https://docs.tyntec.com/problems/DataNotParseable",
"title": "The given data were not parsable.",
"status": 400,
"detail": "Unexpected end-of-input: expected close marker for Object (start marker at [Source: UNKNOWN; line: -1, column: -1) at [Source: UNKNOWN; line: 1, column: 97]\n"
}
The problem object follows RFC-7807.
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
type | string | false | none | The URI reference [RFC3986] that identifies the problem type |
title | string | false | none | Short, human-readable summary of the problem type |
status | number | false | none | The HTTP status code (RFC7231, Section 6) generated by the origin server for this occurrence of the problem |
detail | string | false | none | Human-readable explanation specific to this problem occurrence |