---
title: "score_contributions_model_contribution_post"
method: POST
path: "/model/contribution"
---

# score_contributions_model_contribution_post

`POST /model/contribution`

## Request

- Base URL: `https://www.example.com`
- URL: `https://www.example.com/model/contribution`
- Auth: none declared
- TypeScript: <https://skmtc.dev/h2o/apis/mlops-scoring-rest-api/docs/model/contribution/post.ts> (a function with typed inputs; its response is checked against the schema)

Computes Shapley contributions for rows sent in the body of the post request.

## Headers

- `authorization` string

## Request body

- union
  - ContributionsRequest
    - `requestShapleyValueType` 'ORIGINAL' | 'TRANSFORMED' | 'NONE', required: The string to say what type of Shap values are needed. `ORIGINAL` implies Shap values of original features are requested, `TRANSFORMED` implies that Shap values of transformed features are requested.
    - `fields` string[], required: An array holding the names of fields in the order of appearance in the `rows` property. The length of `fields` has to match length of each row in `rows`. No duplicates are allowed.
    - `rows` array[], required: An array of rows consisting the actual input data for scoring, one scoring request per row.
      - string[]
  - ScoreRequest
    - `fields` string[], required: An array holding the names of fields in the order of appearance in the `rows` property. The length of `fields` has to match length of each row in `rows`. No duplicates are allowed.
    - `rows` array[], required: An array of rows consisting the actual input data for scoring, one scoring request per row.
      - string[]
    - `noFieldNamesInOutput` boolean: If set to `true`. The scorer will not fill response column names in the `fields` field. This is can be useful to maintain compatibility with older scorer versions or to save bandwidth.
    - `requestPredictionIntervals` boolean: If set to `true`, the scorer will try to fill field `predictionIntervals` in response if it is supported.
    - `includeFieldsInOutput` string[]: An array holding the list of field names to be copied from the input request row to the corresponding scoring output. It is an error to specify a field name not present in the `fields` property, except when it is equal to the `idField` property. In the latter case, the row id would be generated and returned in the response. Note that the order of items in `includeFieldsInOutput` is ignored and the specified fields are returned in the order of appearance in the input request row.
    - `idField` string: Name of the field that holds a row id, e.g., a value that uniquely identifies each row of the request. The caller may specify a name of the field that is not present in fields. In which case, the scorer is allowed to generate a UUID to identify each row (e.g., for logging and monitoring purposes). To retrieve such a generated id as a part of the response, simply name it in the `includeFieldsInOutput`.
    - `requestShapleyValueType` 'ORIGINAL' | 'TRANSFORMED' | 'NONE': The string to say what type of Shap values are needed. `ORIGINAL` implies Shap values of original features are requested, `TRANSFORMED` implies that Shap values of transformed features are requested.

## Response `200`

Successful Response

- ContributionsResponse
  - `features` string[], required: An array holding the names of fields in the order of appearance in the rows of the `contributions` property.
  - `contributionGroups` ContributionGroup[], required: An array of rows consisting of the shapley contributions output corresponding to an output group.
    - `output_group` string: Name of the output group. It will be populated only for multinomial models. Shapley values are not supported for third party models yet, hence this field will not be populated.
    - `contributions` array[], required: n array of rows consisting of the shapley contributions output corresponding to columns in the fields
      - string[]

## Other responses

- `400`: Invalid request content.
- `401`: Unauthorized
- `422`: Validation Error
- `500`: Internal Server Error
- `501`: Not Implemented

---

[API](https://skmtc.dev/h2o/apis/mlops-scoring-rest-api.md) - [All operations](https://skmtc.dev/h2o/apis/mlops-scoring-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/h2o/apis/mlops-scoring-rest-api/revisions/a1b84d5b62f7?raw)
