Authentication
This endpoint returns the authentication token that you will need to use on all endpoints that require authentication, as shown on the Authentication page.
Requirements
Authentication
None
Scope
Request body
email
string
Email of your account on Bunny Studio platform
Email of your account on Bunny Studio platform
password
string
Current password to access your Bunny Studio account
Current password to access your Bunny Studio account
Request example
- Console
- JavaScript
- Python
- PHP - CURL
curl --request POST \
--url https://api.bunnystudio.com/users/auth \
--header "Content-Type: application/json" \
--data '{
"email": "myuser@myemail.com",
"password": "mypassword",
}'
const url = 'https://api.bunnystudio.com/users/auth';
const options = {
method: 'POST',
headers: {
'content-type': 'application/json',
}
body: JSON.stringify(
{
"email": "myuser@myemail.com",
"password": "mypassword",
}
)
};
fetch(url, options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import requests
import json
api_url = "https://api.bunnystudio.com/users/auth"
headers = {
"Content-Type": "application/json; charset=utf-8",
}
body = {
"email": "myuser@myemail.com",
"password": "mypassword",
}
response = requests.post(api_url, headers=headers, json=body)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.bunnystudio.com/users/auth',
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => array(
'content-type': 'application/json',
),
CURLOPT_POSTFIELDS => '{
"email": "myuser@myemail.com",
"password": "mypassword",
}'
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Response format
token
string
Encripted token of the authenticated user
Encripted token of the authenticated user
Response example
{
"token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2Nzc2MzYGR5DG4cCI6MTY4NTQxMjk5MiwiZGF0YSI6eyJpZCI6IjUzEETFSSGiOjB9.bamysdSSeGfZA-MXedjOC9QcHRehfoOLCem57EBh5ahw4TM8SThgjldaBhDloZkkUCLANayqNRVyJiJVGoi_wQ"
}
Error responses
401 User not found
{
status: 401,
type: 'USER_NOT_FOUND',
message: 'Please use a correct email and password',
}
401 User not API enabled
{
status: 401,
type: 'USER_NOT_API_ENABLED',
message: 'The user doesn't have API feature enabled',
}
422 Password required
{
status: 422,
type: 'PASSWORD_REQUIRED',
message: 'The field "password" is required',
}
422 Email required
{
status: 422,
type: 'EMAIL_REQUIRED',
message: 'The field "email" is required',
}
422 Not valid email
{
status: 422,
type: 'EMAIL_REQUIRED_NOT_VALID',
message: 'The field "email" must be a valid email',
}