The official Javascript package of Greip API
Report Issue · Request Feature · Greip Website · Documentation
You can install the Greip JavaScript package using npm, yarn, or via CDN.
npm install greip.js --save
yarn add greip.js
Add the following script tag to your HTML file:
<script src="https://cdn.jsdelivr.net/gh/Greipio/javascript/greip.bundle.js" type="text/javascript"></script>
Note: For Node.js environments, please use our Node.js library.
import {
Lookup,
Threats,
GeoIP,
BulkLookup,
ASN,
BadWord,
Country,
EmailValidation,
PhoneValidation,
PaymentFraud,
IBANValidation,
} from 'greip.js';
The Greip
object is available globally. You can use its methods directly:
Greip.GeoIP({
key: 'your-api-key',
// other options
}).then((response) => {
console.log(response);
});
Below are examples for each available method. All methods return Promises.
Options:
Option | Type | Required | Description |
---|---|---|---|
key | string | Yes | Your API key |
params | string[] | No | Modules: location , security , timezone , currency , device |
format | string | No | Response format: JSON , XML , CSV , Newline |
lang | string | No | Language: EN , AR , DE , FR , ES , JA , ZH , RU |
mode | string | No | live (default) or test |
await GeoIP({ key: 'your-api-key' })
.then((res) => console.log(res.data))
.catch((error) => console.error(error));
Options:
Option | Type | Required | Description |
---|---|---|---|
key | string | Yes | Your API key |
ip | string | Yes | IP address to check |
format | string | No | Response format: JSON , XML , CSV , Newline |
mode | string | No | live (default) or test |
await Threats({ key: 'your-api-key', ip: '1.1.1.1' })
.then((res) => console.log(res.data))
.catch((error) => console.error(error));
Options:
Option | Type | Required | Description |
---|---|---|---|
key | string | Yes | Your API key |
ip | string | Yes | IP address to lookup |
params | string[] | No | Modules: location , security , timezone , currency , device |
format | string | No | Response format: JSON , XML , CSV , Newline |
lang | string | No | Language: EN , AR , DE , FR , ES , JA , ZH , RU |
mode | string | No | live (default) or test |
await Lookup({ key: 'your-api-key', ip: '1.1.1.1' })
.then((res) => console.log(res.data))
.catch((error) => console.error(error));
Options:
Option | Type | Required | Description |
---|---|---|---|
key | string | Yes | Your API key |
ips | string[] | Yes | Array of IP addresses |
params | string[] | No | Modules: location , security , timezone , currency , device |
format | string | No | Response format: JSON , XML , CSV , Newline |
lang | string | No | Language: EN , AR , DE , FR , ES , JA , ZH , RU |
mode | string | No | live (default) or test |
await BulkLookup({ key: 'your-api-key', ips: ['1.1.1.1', '2.2.2.2'] })
.then((res) => console.log(res.data))
.catch((error) => console.error(error));
Options:
Option | Type | Required | Description |
---|---|---|---|
key | string | Yes | Your API key |
asn | string | Yes | ASN to lookup |
mode | string | No | live (default) or test |
await ASN({ key: 'your-api-key', asn: 'AS01' })
.then((res) => console.log(res.data))
.catch((error) => console.error(error));
Options:
Option | Type | Required | Description |
---|---|---|---|
key | string | Yes | Your API key |
text | string | Yes | Text to check |
params | string[] | No | Additional params (see docs) |
format | string | No | Response format: JSON , XML , CSV |
lang | string | No | Language: EN , AR , DE , FR , ES , JA , ZH , RU |
mode | string | No | live (default) or test |
await BadWord({ key: 'your-api-key', text: 'Sample text.' })
.then((res) => console.log(res.data))
.catch((error) => console.error(error));
Options:
Option | Type | Required | Description |
---|---|---|---|
key | string | Yes | Your API key |
countryCode | string | Yes | ISO 3166-1 alpha-2 country code |
params | string[] | No | Modules: language , flag , currency , timezone |
format | string | No | Response format: JSON , XML , CSV , Newline |
lang | string | No | Language: EN , AR , DE , FR , ES , JA , ZH , RU |
mode | string | No | live (default) or test |
await Country({ key: 'your-api-key', countryCode: 'SA' })
.then((res) => console.log(res.data))
.catch((error) => console.error(error));
Options:
Option | Type | Required | Description |
---|---|---|---|
key | string | Yes | Your API key |
string | Yes | Email to validate | |
mode | string | No | live (default) or test |
await EmailValidation({ key: 'your-api-key', email: '[email protected]' })
.then((res) => console.log(res.data))
.catch((error) => console.error(error));
Options:
Option | Type | Required | Description |
---|---|---|---|
key | string | Yes | Your API key |
phone | string | Yes | Phone number |
countryCode | string | Yes | Country code (ISO) |
mode | string | No | live (default) or test |
await PhoneValidation({
key: 'your-api-key',
phone: '123123123',
countryCode: 'US',
})
.then((res) => console.log(res.data))
.catch((error) => console.error(error));
Options:
Option | Type | Required | Description |
---|---|---|---|
key | string | Yes | Your API key |
data | object | Yes | Transaction data (see all fields) |
mode | string | No | live (default) or test |
await PaymentFraud({
key: 'your-api-key',
data: {
// ...transaction and customer details...
},
})
.then((res) => console.log(res.data))
.catch((error) => console.error(error));
Options:
Option | Type | Required | Description |
---|---|---|---|
key | string | Yes | Your API key |
iban | string | Yes | IBAN to validate |
mode | string | No | live (default) or test |
await IBANValidation({ key: 'your-api-key', iban: 'BY86AKBB10100000002966000000' })
.then((res) => console.log(res))
.catch((error) => console.error(error));
For detailed documentation, options, and advanced usage, please visit our official documentation.