API Key Quota Subscription

Overview
For deeper integration, we can setup a quota subscription on a per API key basis. A quota subscription is basically a monthly subscription with a set number of pages for conversion. This subscription will be assigned at an API key level.
If you are learning platform with many schools under you, having an API key for each school with a quota subscription will make your accounting and billing a lot easier, since we would be handling that aspect for you.
This feature is only for partners, please contact sales@getmarked.ai if you are interested.
Note: Please ensure you read our getting started guide first!

Creating API key quota subscription


    https://digitaliser.getmarked.ai/api/v1.0/account/create_api_key/

Quota subscription and API key are created together. This endpoint accepts a HTTP POST and require your developer user account login credentials, a key name, the quota limit, the subscription expiry date. These post variables should be set in the form-data of the request.


import requests

API_URL = "https://digitaliser.getmarked.ai/api/v1.0/account/create_api_key/"
form_data = {
    "username": "developer_account_username",
    "password": "PASSWORD",
    "key-name": "Harvard",
    "LIMIT": 200,
    "year": 2050,
    "month": 12,
}

response = requests.post(API_URL, data=form_data)
print(response.json())


In above sample, the API key will be create with a subscription that ends on Dec 2050 with a monthly quota of 200 pages. Any unconsumed pages does NOT rollover to the next month. The quota renewed on first of every month.

No headers is required in making this HTTPS request since you do not have any API keys yet.
Result
If you made successful HTTP POST request, you should receive the following response:

{
    "status": "success",
    "message": "Api key successfully created. Please copy this key and keep it somewhere safe. For security reasons, we cannot show this API key to you again.",
    "data": {
        "api-key": "API-SECERET-KEY",
        "api-key-name": "Harvard",
        "api-key-prefix": "T3ldPTYC",
        "limit": 200,
        "valid-till": "2050-12-31T23:59:59Z",
    },
}

The subscription expiry date time in valid-till will be in ISO-8601.

Modifying quota subscription


    https://digitaliser.getmarked.ai/api/v1.0/account/modify_quota_subscription/

Your school might upgrade or downgrade their subscription plan with you and that will require a modification to the quota subscription too.

In the case of an upgrade, the higher quota limit will be applied immediately. In the case of a downgrade, the lower quota limit will be applied in the next month.

You may also choose to change the subscription expiry date without changing the quota limit too in the event that your school might want to terminate early or renew the subscription.

import requests

API_URL = "https://digitaliser.getmarked.ai/api/v1.0/account/create_api_key/"
headers = {"AUTHORIZATION": "Api-Key YOUR-SECRET-API-KEY"}
form_data = {
    "LIMIT": 300,
    "year": 2050,
    "month": 12,
}

response = requests.post(API_URL, data=form_data, headers=headers)
print(response.json())

In the above example, we increase the limit from 200 to 300 without any change the subscription end date. Please note that your developer user login credentials is NOT required anymore. We authenticate using your secret API key that you set in the header of the HTTP POST.
Result
You should have received the following response:

{
    "status": "success",
    "message": "Limit successfully updated for api key T3ldPTYC",
    "data": {
        "api-key-name": "Harvard",
        "api-key-prefix": "T3ldPTYC",
        "limit": 300,
        "valid-till": "2050-12-31T23:59:59Z",
    },
}

Please visit API endpoints for more comprehensive documentations on the endpoints.