Authentication
The VerifyAPI uses API keys to authenticate requests. You can view and manage your API keys in the VerifyPI portal
Your API keys allows you to send out verifications from your account, so be sure to keep the, secure! Do not share your API keys in publicly accessible areas such as GitHub, client-side code, and so forth.
Authentication to the API is performed via HTTP bearer tokens. Provide your API key as the bearer token value. There is no need to encode the value using base64.
http
Authorization: Bearer 6bce5b6a20d840b29ff00b6227ec1086
All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail and return an HTTP 401 Unauthorized response.
Examples
Below are some examples on how to add the Authorization
header in various languages:
bash
curl --request POST \
--url https://api.verifyapi.dev/verify \
--header 'Authorization: Bearer 6bce5b6a20d840b29ff00b6227ec1086' \
--data ''
csharp
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.verifyapi.dev/verify"),
Headers =
{
{ "Authorization", "Bearer 6bce5b6a20d840b29ff00b6227ec1086" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
go
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.verifyapi.dev/verify"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer 6bce5b6a20d840b29ff00b6227ec1086")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
java
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.verifyapi.dev/verify"))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer 6bce5b6a20d840b29ff00b6227ec1086")
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
javascript
fetch('https://api.verifyapi.dev/verify', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer 6bce5b6a20d840b29ff00b6227ec1086'
},
body: undefined
})
javascript
const axios = require('axios').default;
const options = {
method: 'POST',
url: 'https://api.verifyapi.dev/verify',
headers: {'Content-Type': 'application/json',
Authorization: 'Bearer 6bce5b6a20d840b29ff00b6227ec1086' }
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
php
$request = new HttpRequest();
$request->setUrl('https://api.verifyapi.dev/verify');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'Content-Type' => 'application/json',
'Authorization' => 'Bearer 6bce5b6a20d840b29ff00b6227ec1086'
]);
$request->setContentType('application/json');
$request->setPostFields(null);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
python
import http.client
conn = http.client.HTTPSConnection("api.verifyapi.dev")
payload = ""
headers = {
'Content-Type': "application/json",
'Authorization': "Bearer 6bce5b6a20d840b29ff00b6227ec1086"
}
conn.request("POST", "/verify", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
ruby
require 'uri'
require 'net/http'
url = URI("https://api.verifyapi.dev/verify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["Authorization"] = 'Bearer 6bce5b6a20d840b29ff00b6227ec1086'
response = http.request(request)
puts response.read_body