Getting Started
Get started with the QuantumFold’s API Usage.
This section guides you through the initial steps required to use the QuantumFold APIs, including authentication, required headers, and obtaining access tokens for secure communication.
Each API request must include the following request headers:
- x-api-key
(required)Your unique API key. Contact us atinfo(at)qupass(dot)into obtain one. - Authorization
(required)The JWT token issued for the active session. - qu-token
(required)The Qufold session token. - Content-Type
(required)Must be set to application/json.
Login
Use this endpoint to authenticate and retrieve the tokens required for API access.
METHOD: POST
ENDPOINT: https://dev.qupass.in/auth/login
Request
PAYLOAD DETAILS
- email
(required)Your registered email address. - password
(required)Your account password.
- email
A successful login returns both a JWT token and a qu-token, which must be included in the headers of protection endpoint requests.
Sample Request
curl --location 'https://dev.qupass.in/auth/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "<USER_EMAIL>",
"password": "<USER_PASSWORD>"
}'
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
payload := map[string]string{
"email": "<USER_EMAIL>",
"password": "<USER_PASSWORD>",
}
jsonData, err := json.Marshal(payload)
if err != nil {
panic(err)
}
req, err := http.NewRequest("POST", "https://dev.qupass.in/auth/login", bytes.NewBuffer(jsonData))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println("Status:", resp.Status)
fmt.Println("Response:", string(body))
}
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
public class LoginRequest {
public static void main(String[] args) {
try {
URL url = new URL("https://dev.qupass.in/auth/login");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
String jsonInputString = "{ \"email\": \"<USER_EMAIL>\", \"password\": \"<USER_PASSWORD>\" }";
try (OutputStream os = conn.getOutputStream()) {
byte[] input = jsonInputString.getBytes("utf-8");
os.write(input, 0, input.length);
}
int status = conn.getResponseCode();
Scanner sc = new Scanner(conn.getInputStream(), "utf-8");
StringBuilder response = new StringBuilder();
while (sc.hasNextLine()) {
response.append(sc.nextLine());
}
sc.close();
System.out.println("Status: " + status);
System.out.println("Response: " + response.toString());
conn.disconnect();
} catch (Exception e) {
e.printStackTrace();
}
}
}
async function login() {
try {
const response = await fetch("https://dev.qupass.in/auth/login", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
email: "<USER_EMAIL>",
password: "<USER_PASSWORD>"
})
});
const data = await response.json();
console.log("Status:", response.status);
console.log("Response:", data);
} catch (error) {
console.error("Error:", error);
}
}
login();
<?php
$url = "https://dev.qupass.in/auth/login";
$data = [
"email" => "<USER_EMAIL>",
"password" => "<USER_PASSWORD>"
];
$jsonData = json_encode($data);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"Content-Length: " . strlen($jsonData)
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "Status: " . $httpCode . PHP_EOL;
echo "Response: " . $response . PHP_EOL;
?>
import requests
url = "https://dev.qupass.in/auth/login"
payload = {
"email": "<USER_EMAIL>",
"password": "<USER_PASSWORD>"
}
headers = {
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print("Status:", response.status_code)
print("Response:", response.text)
Sample Response
{
"statusCode": 201,
"message": "Login successful",
"jwt_token": "<JWT_TOKEN>",
"qu_token": "<QU_TOKEN>"
}
These tokens remain valid for 24 hours. After they expire, call the Login endpoint again to obtain fresh tokens.