Skip to content

Authentication

WhiteIntel Intelligence Solutions edited this page May 19, 2024 · 7 revisions

Authentication API

Description

The Authentication API allows users to obtain an API key by sending a POST request with their credentials. This API key is required for accessing other protected endpoints in the system. If you do not already have an account, you need to register via WhiteIntel Register Page

Important Note

Please be aware that you will not be able to view your API key after it has been generated. It is recommended to store the key in a secure vault. Alternatively, you can create a new API key at any time. Please note that generating a new key will invalidate and remove any previously created keys.

Endpoint

POST /api/authenticate.php

Required Headers

Name Description
Content-Type Must be set to application/json

Parameters

Name Type Required Description
email string Yes The username of the user
password string Yes The password of the user

Sample Request

Request URL

POST /api/authenticate.php

Request Body

{
    "email": "exampleUser",
    "password": "examplePassword"
}

Sample Success Response

{
    "success": true,
    "apikey": "abc123def456ghi789jkl012mno345pqr678stu"
}

Sample Error Response

{
 
    "error": "Invalid username or password"
}

Code Examples

Example using Curl

curl -X POST https://whiteintel.io/api/authenticate.php \
     -H "Content-Type: application/json" \
     -d '{
           "email": "exampleUser",
           "password": "examplePassword"
         }'

Example using Python

import requests

url = "https://whiteintel.io/api/authenticate.php"
payload = {
    "email": "exampleUser",
    "password": "examplePassword"
}
headers = {
    "Content-Type": "application/json"
}

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

if response.status_code == 200:
    print("Response:", response.json())
else:
    print("Failed to authenticate:", response.status_code, response.text)

Clone this wiki locally