Authentication
For authorization, ProAPIs requires you to include your API key in the x-api-key
header for each request. Below are examples demonstrating how to set this up in different programming languages.
Example in Python
Using the requests
library, you can include the x-api-key
header as shown below:
import requests
api_key = 'YOUR_API_KEY'
url = 'https://api.proapis.com/example-service'
headers = {
'x-api-key': api_key,
'content-type': 'application/json'
}
payload = {}
response = requests.post(url, headers=headers, json=payload)
data = response.json()
print(data)
Example in JavaScript
Using the fetch
API, you can set the header as follows:
const apiKey = 'YOUR_API_KEY';
const url = 'https://api.proapis.com/example-service';
const payload = {}
fetch(url, {
method: 'POST',
headers: {
'x-api-key': apiKey,
'content-type': 'application/json'
},
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
Example in cURL
With cURL
, you can specify the header in your request like this:
curl -H "x-api-key: YOUR_API_KEY" -d "{}" "https://api.proapis.com/example-service"