API Documentation
api.scoremachine.ai
Introduction
The api.scoremachine.ai API provides fast, secure, and real-time validation of phone numbers and emails.
It is designed to integrate seamlessly into any technology stack, making it ideal for businesses of all sizes.
The API offers detailed information about phone numbers, including carrier details, location, and more. For a full list of features, visit our project website https://scoremachine.ai/
Base URL, Authentication, Methods
- Base URL:
https://api.scoremachine.ai/
- Authentication: Requests are authenticated using a client token
- Supported HTTP Methods:
POST
,GET
Conventions
Data Format | JSON |
Encoding | UTF-8 |
HTTP Methods | GET, POST |
Field Naming Convention | snake_case |
Errors and HTTP Status Codes
Successful Request | 200 | OK |
Validation Error | 422 | Validation Error |
Invalid Parameters | 400 | Bad Request |
Missing Authentication | 401 | Unauthorized |
Resource Not Found | 404 | Not Found |
Server Error | 500 | Internal Server Error |
Endpoints
scoring POST /validation
URL: https://api.scoremachine.ai/validation
HTTP Method: POST
Description:
This method validates a single `phone` number and retrieves additional information about it. You can specify which checks to perform by setting the appropriate parameters in the request body. Parameters `POST` /validation:
Parameters:
phone | string | The `phone` number to validate |
normalization | boolean | Set to `true` to normalize the `phone` number into various formats Example: "international_format": "+0 000 000-00-00", "local_format": "0 (000) 000-00-00", "e164_format": "+00000000000", |
tg | boolean | Set to `true` to check if a TG account is linked to the `phone` number |
wa | boolean | Set to `true` to check if a WA account is linked to the `phone` number |
validation | boolean | Set to `true` to retrieve detailed information about the `phone` number Example: { "prefixer": { "carrier": "Carrier_name", "carrier_full": "Carrier_full_name", "location": "Location", "timezone": "UTC+0", "country": "Country", "line_type": "mobile", "iso_code": "XX" } } |
Example Request POST /validation
curl -X 'POST' \ 'http://api.scoremachine.ai/validation' \ -H 'accept: application/json' \ -H 'token: your_token' \ -H 'Content-Type: application/json' \ -d '{ "phone": "00000000000", "normalization": true, "tg": false, "wa": false, "validation": false }'
Example Response POST /validation
{ "phone": "00000000000", "normalized_phone": "00000000000", "normalization": { "international_format": "+0 000 000-00-00", "local_format": "0 (000) 000-00-00", "e164_format": "+00000000000" }, "validation_time": "yyyy-mm-dd hh:mm:ss" }
Response Fields `POST` /validation endpoint contains:
phone | string | The `phone` number provided in the request |
normalized_phone | string | Returns only the digits from the provided `phone` for normalization and database lookup |
normalization | dictionary | Contains the normalized formats of the `phone` number Example: "normalization": { "international_format": "+0 000 000-00-00", "local_format": "0 (000) 000-00-00", "e164_format": "+00000000000" }, |
validation_time | date-time | The timestamp of when the request was processed, in `yyyy-mm-dd hh:mm:ss` format |
Possible Errors POST /validation
401 | recaptcha invalid | Occurs when the `recaptcha-token` is missing or invalid Example: { "details": "Invalid reCAPTCHA verification", "status_code": 401 } |
401 | token invalid | Occurs when the system `token` is missing or invalid Example: { "details": "Missing or invalid Authorization header", "status_code": 401 } |
400 | low balance | Occurs when the account balance is zero or negative Example: { "detail": "Low balance", "status_code": 400 } |
POST /validation/batch
URL: https://api.scoremachine.ai/validation/batch
HTTP Method: POST
Description:
This method validates multiple `phones` numbers in a single request. After submitting the request, you will receive a task `id` that you can use to check the status and results of the batch validation. Parameters `POST` /validation/batch:
Parameters:
phones | list | A list of `phones` numbers to validate |
normalization | boolean | Set to `true` to normalize the `phones` numbers into various formats Example: "international_format": "+0 000 000-00-00", "local_format": "0 (000) 000-00-00", "e164_format": "+00000000000", |
tg | boolean | Set to `true` to check if TG accounts are linked to the `phones` numbers |
wa | boolean | Set to `true` to check if WA accounts are linked to the `phones` numbers |
validation | boolean | Set to `true` to retrieve detailed information about the `phones` numbers Example: "prefixer": { "carrier": "Carrier_name", "carrier_full": "Carrier_full_name", "location": "Location", "timezone": "UTC+0", "country": "Country", "line_type": "mobile", "iso_code": "XX" }, |
Example Request:
curl -X 'POST' \ 'http://api.scoremachine.ai/validation/batch' \ -H 'accept: application/json' \ -H 'token: your_token' \ -H 'Content-Type: application/json' \ -d '{ "phones": [ "00000000000", "00000000000", "00000000000" ], "normalization": true, "tg": true, "wa": true, "validation": true }'
Example Response POST /validation/batch
"000xx0x0-00x0-0xxx-00x0-0xxx000xx000"
Response Field `POST` /validation/batch endpoint contains:
id | string | The task `id` generated for the batch validation |
Possible Errors POST /validation/batch
401 | token invalid | Occurs when the system `token` is missing or invalid Example: { "details": "Missing or invalid Authorization header", "status_code": 401 } |
400 | low balance | Occurs when the account balance is zero or negative Example: { "detail": "Low balance", "status_code": 400 } |
POST /validation/email
URL: https://api.scoremachine.ai/validation/email
HTTP Method: POST
Description:
This method validates a single `email` address and retrieves additional information about it. In the request, a JSON object is sent containing the `email` field with the email address to be validated. Example:
{ "email": "[email protected]" }
Parameters for `POST` /validation/email:
string | The `email` address to validate |
Example Request POST /validation/email
curl -X 'POST' \ 'http://api.scoremachine.ai/validation/email' \ -H 'accept: application/json' \ -H 'token: your_token' \ -H 'Content-Type: application/json' \ -d '{ "email": "[email protected]" }'
Example Response POST /validation/email
{ "email": "[email protected]", "valid": true, "probable_name": "User Name", "profile_photo": "https://xx0.googleusercontent.com/x-/XXX-XxX0Xx0X-x0", "last_update": "yyyy-mm-dd hh:mm:ss", "probable_country": null, "country_code": null, "provider": "gmail-smtp-in.l.google.com", "validation_time": "yyyy-mm-dd hh:mm:ss" }
Response Fields `POST` /validation/email endpoint contains
string | The `email` address provided in the request | |
valid | boolean | A value of `true` indicates that the email is valid. If the email is invalid, the value will be `false`, and all other fields will return `null` |
probable_name | string | The probable name associated with the email. Available only for Google accounts (both personal and business), returns `null` for other emails |
profile_photo | string | A link to the profile photo of the Google account Available only for Google accounts, returns `null` for other emails. |
last_update | date-time | The timestamp of the last account update in `yyyy-mm-dd hh:mm:ss` format. Available only for Google accounts, returns `null` for other emails. |
probable_country | string | The probable country associated with the email. Available only for Google accounts, returns `null` for other emails. |
country_code | string | The two-letter country code in Alpha-2 ISO 3166-1 format. Available only for Google accounts, returns `null` for other emails. |
provider | string | The SMTP domain of the email provider |
validation_time | date-time | The timestamp of when the validation was performed, in `yyyy-mm-dd hh:mm:ss` format. |
Possible Errors POST /validation/email
401 | recaptcha invalid | Occurs when the `recaptcha-token` is missing or invalid Example: { "details": "Invalid reCAPTCHA verification", "status_code": 401 } |
401 | token invalid | Occurs when the system `token` is missing or invalid Example: { "details": "Missing or invalid Authorization header", "status_code": 401 } |
400 | low balance | Occurs when the account balance is zero or negative Example: { "detail": "Low balance", "status_code": 400 } |
GET /task/{id}
URL: https://api.scoremachine.ai/task/{id}
HTTP Method: GET
Description:
This method retrieves the results of a batch validation task using the task `id` returned by the `POST` /validation/batch endpoint:
Parameters:
id | string | task `id` |
Example Request GET /task/{id}
curl -X 'GET' \ 'http://api.scoremachine.ai/task/000xx0x0-00x0-0xxx-00x0-0xxx000xx000' \ -H 'accept: application/json' \ -H 'token: your_token'
Example Response GET /task/{id}
{ "task_id": "000xx0x0-00x0-0xxx-00x0-0xxx000xx000", "task_status": "SUCCESS", "task_result": { "00000000000": { "valid": true, "normalized_phone": "00000000000", "tg": false }, "00000000000": { "valid": true, "normalized_phone": "00000000000", "tg": false }, "00000000000": { "valid": true, "normalized_phone": "00000000000", "tg": false } } }
Response Fields `GET` /task/{id} endpoint contains:
task_id | string | The task `id` |
task_status | string | The status of the `task_status`. Possible values: `PENDING` : The task is waiting to be processed `STARTED` : The task is currently being processed `SUCCESS` : The task has been successfully completed `FAILURE` : An error occurred while processing the task `RETRY` : The task has been queued for retry after a failure `REVOKED` : The task was canceled before or during execution |
task_result | dictionary | The results of the `task_result` in JSON format |
Possible Errors GET /task/{id}
401 | token invalid | Occurs when the system `token` is missing or invalid Example: { "details": "Missing or invalid Authorization header", "status_code": 401 } |
GET /user/get-balance
URL: https://api.scoremachine.ai/user/get-balance
HTTP Method: GET
Description:
This method retrieves the current balance of the authenticated user. No parameters are required, as the method provides balance information for the currently authorized user.
Example Request GET /user/get-balance
curl -X 'GET' \ 'http://api.scoremachine.ai/user/get-balance' \ -H 'accept: application/json' \ -H 'token: your_token'
Example Response GET /user/get-balance
{ "balance": 100500 }
Response Fields `GET` /user/get-balance endpoint contains
balance | float | The amount of funds available in the user's account |
Possible Errors GET /user/get-balance
401 | token invalid | Occurs when the system `token` is missing or invalid Example: { "details": "Missing or invalid Authorization header", "status_code": 401 } |
GET /user/get-transactions
URL: https://api.scoremachine.ai/user/get-transactions
HTTP Method: GET
Description:
This method retrieves a list of transactions showing deductions from the balance of the authenticated user. No parameters are required, as the method provides transaction history for the currently authorized user.
Example Request GET /user/get-transactions
curl -X 'GET' \ 'http://api.scoremachine.ai/user/get-transactions' \ -H 'accept: application/json' \ -H 'token: your_token'
Example Response GET /user/get-transactions
{ "items": [ { "timestamp": "YYYY-MM-DD HH:MM:SS", "amount": -0.0, "comment": "Score machine validation - batch - count of phones: 3, task id: None" }, { "timestamp": "YYYY-MM-DD HH:MM:SS", "amount": -0.0, "comment": "Score machine validation - phone: 00000000000" } ], "total": 0 }
Response Fields `GET` /user/get-transactions endpoint contains
items | array [{}] | A list of dictionaries containing transaction details for the authenticated user. Each item includes: `timestamp` (string) : the date and time when the transaction occurred, in YYYY-MM-DD HH:MM:SS format. `amount` (float) : the amount deducted in the transaction. `comment` (string) : a description of the transaction. |
total | int | The `total` (integer) number of transactions returned in the response. |
Possible Errors GET /user/get-transactions
401 | token invalid | Occurs when the system `token` is missing or invalid Example: { "details": "Missing or invalid Authorization header", "status_code": 401 } |
Contacts
For questions about implementing or using api.scoremachine.ai feel free to reach out to us:
Technical Support & Commercial Inquiries [email protected]
Website https://scoremachine.ai/