Sign In (Bearer)
POST /signin
Endpoint to obtain an access token from your email and password. The accessToken you receive is sent in the header of every subsequent request as Authorization: Bearer {accessToken}.
Is this your method?
Use this guide if Blacktrust gave you an email and a password. If it gave you an API Key, your method is API Key and you do not need to call /signin. The two methods are alternatives: see the Authentication overview.
Request Example
- cURL
- Node.js
curl -X POST "{BASE_URL}/signin" \
-H "Content-Type: application/json" \
-d '{
"email": "user@client.com",
"password": "your_secure_password"
}'
const response = await fetch("{BASE_URL}/signin", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
email: "user@client.com",
password: "your_secure_password",
}),
});
API Responses
- 200 OK
- 401 Unauthorized
200 OK (Successful Authentication)
Returns the access token needed to consume the other API endpoints.
{
"success": true,
"name": "Jane Doe",
"profile": "blacktrust_tech",
"photoURL": "",
"client": "JHR1c0....",
"clients": [
"JHR1c0..."
],
"accessToken": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjRiMTFjYjdhYjVmY2JlNDFlOTQ4MDk.....",
"refreshToken": "AMf-vBz886nr68QaW_XWCZxsW8-tW_VO2V2gu9eH....."
}
401 Unauthorized (Invalid Credentials)
Returns this error if the email or password is incorrect.
{
"success": false,
"error": "El nombre de usuario o la contraseña son incorrectos."
}