Register a Model as an API

Step 1: Publish a Model as an API

Publish a registered model as an API from the Models tab. Only registered models display the Register as API option.

  1. Go to Data Science Lab > Models

  2. You will be redirected to the Model list page.

  3. Filter by Registered (or choose All) to locate your model.

  4. Select the registered model.

  5. Click Register as API.

  6. The Update Model page opens.

  7. Set Max instance limit (maximum concurrent instances for this API).

  8. Click Save and Register.

    • Use Save (without Register) if you want to persist changes and publish later.

  9. A notification confirms that the model has been published as an API.

Where to find it next:

  • The published entry appears under the Model list as a registered model.

Step 2: Register an API Client

Register a client to obtain Client ID and Client Secret for authenticated access.

  1. Open the Admin module.

  2. Click API Client Registration.

  3. Click New.

  4. Set Client type = internal.

  5. Provide client details:

    • Client Name

    • Client Email

    • App Name

    • Request Per Hour

    • Request Per Day

  6. Select API Type: choose Model as API.

  7. Services Entitled: select the published DSL model from the drop-down.

  8. Click Save.

  9. After saving, open the registered client using Edit to view the generated Client ID and Client Secret.

circle-info

Keep these credentials secure. You’ll pass them as headers when calling the API.

Step 3: Invoke the API (Postman)

The Model as API interaction follows an asynchronous pattern:

  1. Execution Request → returns a Request ID

  2. Get Status (poll using Request ID)

  3. Get Results (using the same Request ID)

Base URLs

  • Start service / submit request https://app.bdb.ai/services/modelasapi/<model_name>

  • Check status https://app.bdb.ai/services/modelasapi/<model_name>/getStatus

  • Get results https://app.bdb.ai/services/modelasapi/<model_name>/getResults

Required Headers (all requests)

  • Client Id: <your_client_id>

  • Client Secret Key: <your_client_secret>

  • App Name: <your_app_name>

circle-info

Note: Header keys must match exactly as shown above.

3.1 Execution Request (start job)

  1. In Postman, create a POST request to https://app.bdb.ai/services/modelasapi/<model_name>

  2. Set the required Headers (Client ID, Client Secret Key, App Name).

  3. In Body (JSON), provide the model input as a JSON list (array) of records.

  4. Click Send.

Sample body (illustrative):

Expected response (fields):

  • Success: true If the request is accepted.

  • Request ID: a unique identifier for this execution.

  • Message: acknowledges that the service has started.

circle-info

Behaviour: A job spins up at the tenant level to process requests. Input data is placed on a Kafka topic and automatically cleared after 4 hours.

3.2 Get Status Request

  1. Create a POST request to https://app.bdb.ai/services/modelasapi/<model_name>/getStatus

  2. Set the same Headers.

  3. In Body (JSON), provide the previously received Request ID:

  1. Click Send.

Expected response (fields):

  • Success: true If the request is valid.

  • Request ID: echoes your ID.

  • Status Message: indicates whether execution is running, completed, or failed.

3.3 Get Results Request

  1. Create a POST request to https://app.bdb.ai/services/modelasapi/<model_name>/getResults

  2. Set the same Headers.

  3. In Body (JSON), provide the Request ID:

  1. Click Send.

Expected outcome: The model prediction results are returned in the response.

circle-info

Storage: Output data is also stored under Sandbox repository → Model as API → <DSL Project> → <Request sub-folder>.

Operational Notes

  • Asynchronous execution: Always capture and reuse the Request ID to check status and fetch results.

  • Resource control: The Max instance limit governs concurrency for the model API.

  • Data retention: Input messages on Kafka are cleared approximately every 4 hours.

  • Access control: Only clients registered with Model as API entitlement can call the service.

Troubleshooting

  • 401/403 Unauthorized: Verify Client ID, Client Secret Key, App Name, and that the client is entitled to the published model.

  • Service doesn’t start: Confirm the model is registered and register as an API has been completed; check instance limits.

  • Status stuck in running: Retry after a short interval; review platform logs if delays persist.

  • No results: Ensure you’re using the correct Request ID; verify the job completed successfully via Get Status.

  • Schema errors: Validate that the input JSON structure matches the model’s expected features and datatypes.