Skip to main content
POST
/
auth
/
token-form
Login For Access Token Form
curl --request POST \
  --url https://api-sandbox.axle.energy/auth/token-form \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data 'username=<string>' \
  --data 'password=<string>' \
  --data grant_type=password
import requests

url = "https://api-sandbox.axle.energy/auth/token-form"

payload = {
"username": "<string>",
"password": "<string>",
"grant_type": "password"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}

response = requests.post(url, data=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({username: '<string>', password: '<string>', grant_type: 'password'})
};

fetch('https://api-sandbox.axle.energy/auth/token-form', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api-sandbox.axle.energy/auth/token-form",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "username=%3Cstring%3E&password=%3Cstring%3E&grant_type=password",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api-sandbox.axle.energy/auth/token-form"

payload := strings.NewReader("username=%3Cstring%3E&password=%3Cstring%3E&grant_type=password")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api-sandbox.axle.energy/auth/token-form")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("username=%3Cstring%3E&password=%3Cstring%3E&grant_type=password")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api-sandbox.axle.energy/auth/token-form")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "username=%3Cstring%3E&password=%3Cstring%3E&grant_type=password"

response = http.request(request)
puts response.read_body
{
  "access_token": "<string>",
  "token_type": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Body

application/x-www-form-urlencoded
username
string
required
password
string
required
grant_type
string
default:password
Pattern: ^password$

Response

Successfully authenticated with access token

Organisation scoped token.

access_token
string
required
token_type
string
required