Admin API - NT AI Connect

Provided by VISAI

Login

login to get the access token for using admin api.

POST /login

Header:

Content-Type: application/json
Body Parameters

Example Request:

curl --location 'https://admin-gateway.nt-ai.cloud/login' \
--header 'Content-Type: application/json' \
--data '{
    "email": "admin@email.com",
    "password": "password"
}'

Example Response Body:

{
    "accessToken": "{access_token}",
    "refreshToken": "{refresh_token}"
}

Register

create a new admin account.

POST /register

Header:

Content-Type: application/json
Body Parameters

Example Request:

curl --location 'https://admin-gateway.nt-ai.cloud/register' \
--header 'Content-Type: application/json' \
--data '{
    "email": "admin@email.com",
    "password": "password"
}'

Refresh

get a new access token of admin account.

POST /refresh

Header:

Content-Type: application/json
Body Parameters

Example Request:

curl --location 'https://admin-gateway.nt-ai.cloud/refresh' \
--header 'Content-Type: application/json' \
--data '{
    "refreshToken": "{refresh_token}"
}'

Example Response Body:

{
    "accessToken": "{access_token}",
    "refreshToken": "{refresh_token}"
}

FindAllAccount

provides all accounts in AI Connect platform.

POST /findAllAccount

Header:

Content-Type: application/json
Authorization: Bearer {access_token}
Body Parameters

Note: If you do not want to apply any filters, you should still send an empty JSON object {} in the request body. This ensures the API receives a valid JSON payload and processes the request correctly.

Example Request:

curl --location 'https://admin-gateway.nt-ai.cloud/findAllAccount' \
--header 'Authorization: Bearer {access_token}' \
--header 'Content-Type: application/json' \
--data '{
    "approvalStatus": "APPROVED"
    "currentPage": 1,
    "limit": 10
}'

Example Response Body:

{
    "accounts": [
        {
            "id": "XXX",
            "email": "XXXX",
            "isVerified": true,
            "status": "ACTIVE",
            "userInformation": {
                "firstName": "XXXX",
                "lastName": "XXXX",
                "phoneNumber": "+66XXXXXXXXX",
                "organization": "XXX",
                "country": "Thailand"
            },
            "approvalStatus": "APPROVED",
            "createdAt": "2024-07-16T15:36:29.610695+07:00",
            "updatedAt": "2024-07-16T15:43:56.986902+07:00"
        },
        {
            "id": "XXX",
            "email": "XXXX",
            "isVerified": true,
            "status": "ACTIVE",
            "userInformation": {
                "firstName": "XXXX",
                "lastName": "XXXX",
                "phoneNumber": "+66XXXXXXXXX",
                "organization": "XXX",
                "country": "Thailand"
            },
            "approvalStatus": "APPROVED",
            "createdAt": "2024-07-16T15:35:21.505701+07:00",
            "updatedAt": "2024-07-16T15:43:54.88832+07:00"
        }
    ],
    "metadata": {
        "currentPage": 1,
        "limit": 10,
        "totalPage": 1
    }
}

FindAccount

provides a specific account in AI Connect platform by account id.

POST /findAccount

Header:

Content-Type: application/json
Authorization: Bearer {access_token}
Body Parameters

Example Request:

curl --location 'https://admin-gateway.nt-ai.cloud/findAccount' \
--header 'Authorization: Bearer {access_token}' \
--header 'Content-Type: application/json' \
--data '{
    "accountID": "{account_id}"
}'

Example Response Body:

{
    "id": "{account_id}",
    "email": "XXXXX",
    "isVerified": true,
    "userInformation": {
        "firstName": "XXXXX",
        "lastName": "XXXXX",
        "phoneNumber": "+66XXXXXXXXX",
        "organization": "",
        "country": "Thailand"
    },
    "status": "ACTIVE",
    "approvalStatus": "NONE",
    "createdAt": "2024-07-13T17:54:37.834284+07:00",
    "updatedAt": "2024-07-13T17:54:37.835318+07:00"
}

FindAllAccountSummary

provides all accounts with request and credit summary of the account in AI Connect platform.

POST /findAllAccountSummary

Header:

Content-Type: application/json
Authorization: Bearer {access_token}
Body Parameters

Note: If you do not want to apply any filters, you should still send an empty JSON object {} in the request body.

Example Request:

curl --location 'https://admin-gateway.nt-ai.cloud/findAllAccountSummary' \
--header 'Authorization: Bearer {access_token}' \
--header 'Content-Type: application/json' \
--data '{
    "inferenceStartAt": "2024-05-15T14:52:05.476Z",
    "inferenceEndAt": "2024-05-16T14:52:05.476Z"
}'

Example Response Body:

{
    "accountSummaries": [
         {
            "id": "XXX",
            "email": "XXX",
            "firstName": "XXXX",
            "lastName": "XXXX",
            "totalRequest": 20,
            "totalCredit": 9.16
        },
    ]
}

FindAllInferenUsage

provides inference usage that have been occurred in AI Connect platform.

POST /findAllInferenceUsage

Header:

Content-Type: application/json
Authorization: Bearer {access_token}
Body Parameters

Note: If you do not want to apply any filters, you should still send an empty JSON object {} in the request body.

Example Request:

curl --location 'https://admin-gateway.nt-ai.cloud/findAllInferenceUsage' \
--header 'Authorization: Bearer {access_token}' \
--header 'Content-Type: application/json' \
--data '{
    "accountID": "{account_id}",
    "product": "{product}",
    "inferenceStartAt": "2024-05-15T14:52:05.476Z",
    "inferenceEndAt": "2024-05-16T14:52:05.476Z"
}'

Example Response Body:

{
    "inferenceUsages": [
        {
            "accountID": "{account_id}",
            "apiKey": "XXXX",
            "apiKeyName": "XXXX",
            "product": "sentiment-analysis",
            "inputSize": 10,
            "inputUnit": "character",
            "credit": 0.04,
            "inferencedAt": "2024-06-19T11:49:14.314659+07:00"
        },
        {
            "accountID": "{account_id}",
            "apiKey": "XXXX",
            "apiKeyName": "XXXX",
            "product": "ocr-passport",
            "inputSize": 1,
            "inputUnit": "page",
            "credit": 0.75,
            "inferencedAt": "2024-07-01T19:44:30.518728+07:00"
        }
    ]
}

FindAllInferenceServerError

provides inference server error that have been occurred in AI Connect platform.

POST /findAllInferenceServerError

Header:

Content-Type: application/json
Authorization: Bearer {access_token}
Body Parameters

Note: If you do not want to apply any filters, you should still send an empty JSON object {} in the request body.

Example Request:

curl --location 'https://admin-gateway.nt-ai.cloud/findAllInferenceServerError' \
--header 'Authorization: Bearer {access_token}' \
--header 'Content-Type: application/json' \
--data '{
    "dateTimeStart": "2024-05-15T14:52:05.476Z",
    "dateTimeEnd": "2024-05-16T14:52:05.476Z"
}'

Example Response Body:

{
    "inferenceLog": {
        "took": 0,
        "timed_out": false,
        "_shards": {
            "total": 1,
            "successful": 1,
            "skipped": 0,
            "failed": 0
        },
        "hits": {
            "total": {
                "value": 0,
                "relation": "eq"
            },
            "max_score": null,
            "hits": []
        }
    }
}

ProductLisings

provides all available products.

URL https://marketplace.nt-ai.cloud
GET /listings

Example Request:

curl --location 'https://marketplace.nt-ai.cloud/listings'

Example Response Body:

[
      {
        "id": "a936cf7d-b8f9-4955-9103-a90c030a0c14",
        "name": "OCR Passport",
        "nameTH": "แปลงข้อมูลจากภาพหนังสือเดินทาง",
        "publisherName": "VISAI.ai",
        "inferencerName": "ocrpassport",
        "documentationURL": "https://api-document-9ae.pages.dev/docs/ai-models/ocr-passport",
        "thumbnailURL": "/images/products/ocr-passport.webp",
        "shortDescription": "AI technology is capable of scanning and analyzing passport images, extracting relevant information, and converting it into structured data.",
        "shortDescriptionTH": "AI อ่านภาพหนังสือเดินทาง พร้อมถอดข้อมูลบนหน้าบัตรออกมา เช่น ชื่อ นามสกุล ประเทศ วันเกิด",
        "longDescription": "An OCR passport is automatically identifying and extracting key information from an image of a passport and converts the information into a machine-readable format. For example, given an input image, the model extracts information including name, last name, passport ID, and other fields. This makes it easier and more effective for a computer to understand, analyze, and consume the information. \n\n For this version, the service supports only for the passports issued by Thailand, China, Japan and Philippines. The key information is listed below. \n\n   1. Name\n   2. Surname \n   3. Date of birth\n   4. Gender\n   5. Country code\n   6. Country name\n   7. Passport number\n   8. Passport type\n   9. Date of expiry\n   10. Identification number (Only Thai passport)\n\n\n\n The model was trained on a synthesized dataset with several augmentations applied to the image. The synthesized dataset was generated to mimic the passport format and to make the model more robust on different generation conditions.  \n\nFor more information, visit [Guide Book](https://acp-guidebook.visai.ai/en/ocr-passport)",
        "createdAt": "2023-09-01T14:00:50.646968+07:00",
        "updatedAt": "2024-01-05T19:53:30.418501+07:00",
        "pricing": "0.75 THB / 1 Page",
        "sysTag": [
            "product:ocr-passport",
            "colorCode:#FF822B"
        ],
        "tag": [
            "input-type:image",
            "lang:en"
        ],
        "evaluation": {
            "test": {
                "cer": 0.0002
            }
        }
    }
]