Authentication

Authentication Methods

Each API request must be authenticated using your email and API key. You have three options for including authentication data with your requests:

1. Using the --user Parameter

This is the recommended method and is used in all the examples:

curl --user admin@example.com:APIkey -X GET 'https://www.venddor.com.br/api/users/'

2. Inline URL Authentication

You can pass the credentials directly in the URL:

curl --basic -X GET 'http://admin%40example.com:APIkey@example.com/api/users/'
Note: When using inline URL authentication, the @ character in email addresses must be URL-encoded as %40.

3. Using Authorization Headers

You can include authentication in the request header:

curl --header 'Authorization: Basic <base64-encoded email:APIkey pair>' -X GET 'https://www.venddor.com.br/api/users/'

The email:APIkey pair must be encoded in base64.

PHP Example for Header Authentication

$token = base64_encode("admin@example.com:your_api_key_here");
$authHeaderString = 'Authorization: Basic ' . $token;

// Example of using with cURL
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://www.venddor.com.br/api/users/');
curl_setopt($curl, CURLOPT_HTTPHEADER, [$authHeaderString]);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);