# Predictions for unstructured model deployments
URL: https://docs.datarobot.com/en/docs/api/reference/predapi/legacy-predapi/pred-ref/dep-pred-unstructured.html

> Using a specified endpoint, calculates predictions based on user-provided data for a specific unstructured model deployment.

# Predictions for unstructured model deployments

Using the endpoint below, you can provide the data necessary to calculate predictions for a specific unstructured model deployment. If you need to make predictions for a standard model, see [Predictions for deployments](https://docs.datarobot.com/en/docs/api/reference/predapi/legacy-predapi/pred-ref/dep-pred.html).

Endpoint: `/deployments/<deploymentId>/predictionsUnstructured`

Calculates predictions based on user-provided data for a specific unstructured model deployment. This endpoint works only for deployed custom inference models with an unstructured target type. For more information, see [Assemble unstructured custom models](https://docs.datarobot.com/en/docs/api/code-first-tools/drum/unstructured-custom-models.html).

This endpoint does the following:

- Calls the/predictUnstructuredroute on the target custom inference model, allowing you to use the custom request and response schema, which may go beyond the standard DataRobot prediction API interface.
- Passes any payload and content type (MIME type and charset, if provided) to the model.
- Passes any model-returned payload, along with the content type (MIME type and charset, if provided), back to the caller.

In the [DRUM library](https://docs.datarobot.com/en/docs/api/code-first-tools/drum/custom-model-drum.html), this call is handled by the [score_unstructured()hook](https://docs.datarobot.com/en/docs/api/code-first-tools/drum/unstructured-custom-models.html#score).

> [!NOTE] Note
> You can find the deployment ID in the sample code output of the [Deployments > Predictions > Prediction API](https://docs.datarobot.com/en/docs/classic-ui/predictions/realtime/code-py.html) tab (with Interface set to API Client).

Request Method: `POST`

Request URL: deployed URL, for example: `https://your-company.orm.datarobot.com/predApi/v1.0`

## Request parameters

### Headers

| Key | Description | Example(s) |
| --- | --- | --- |
| Datarobot-key | Required for managed AI Platform users; string type Once a model is deployed, see the code snippet in the DataRobot UI, Predictions > Prediction API. | DR-key-12345abcdb-xyz6789 |
| Authorization | Required; string Three methods are supported: Bearer authentication (deprecated) Basic authentication: User_email and API token (deprecated) API token | Example for Bearer authentication method: Bearer API_key-12345abcdb-xyz6789(deprecated) Example for User_email and API token method: Basic Auth_basic-12345abcdb-xyz6789(deprecated) Example for API token method: Token API_key-12345abcdb-xyz6789 |
| Content-Type | Optional; string type Default: application/octet-stream Any provided content type is passed to the model; however, the DRUM library has a built-in decoding mechanism for text content-types using the specified charset. For more information, see Assemble unstructured custom models. | text/plaintext/csvtext/plain; charset=latin1application/json; charset=UTF-8custom/typeapplication/octet-stream |
| Content-Encoding | Optional; string type Currently supports only gzip-encoding with the default data extension. | gzip |
| Accept | Optional; string type | */* (default) The response is defined by the model output. |
|  |  |  |

### Query arguments

Currently not supported for the `predictionsUnstructured` endpoint.

### Body

| Data | Type | Example(s) |
| --- | --- | --- |
| Data to pass to the custom model | Bytes | PassengerId,Pclass,Name,Sex,Age,SibSp,Parch,Ticket,Fare,Cabin,Embarked 892,3,"Kelly, Mr. James",male,34.5,0,0,330911,7.8292,,Q 893,3,"Wilkes, Mrs. James (Ellen Needs)",female,47,1,0,363272,7,,S 894,2,"Myles, Mr. Thomas Francis",male,62,0,0,240276,9.6875,,Q{“data”: [{“some”: “json”}]}Custom payload 123<binary data> (for example, image data) |

## Response 200

The HTTP Response contains a payload returned by the custom model’s `/predictUnstructured` route and passed back as-is. The `Content-Type` header is passed to the caller. If the `Content-Type` header isn't provided, the `application/octet-stream` default is applied.

In the case of a DataRobot-acknowledged error in a request, an `application/json` error message is returned.

In the [DRUM library](https://docs.datarobot.com/en/docs/api/code-first-tools/drum/custom-model-drum.html), the response payload and content type are generated by the [score_unstructured()hook](https://docs.datarobot.com/en/docs/api/code-first-tools/drum/unstructured-custom-models.html#score).

## Errors list

| HTTP Code | Sample error message | Reason(s) |
| --- | --- | --- |
| 400 BAD REQUEST | {"message":"Query parameters not accepted on this endpoint"} | The request passed query parameters to the endpoint. |
| 404 NOT FOUND | {"message": "Deployment :deploymentId cannot be found for user :userId"} | The request provided an invalid :deploymentId (a deleted or non-existent deployment). |
| 422 UNPROCESSABLE CONTENT | {"message": "Only unstructured custom models can be used with this endpoint. Use /predictions instead.} | The request provided a :deploymentId for a deployment that isn't an unstructured custom inference model deployment. |

---
