---
title: <POST> Model Registration
slug: lesspostgreater-model-registration
docTags: 
createdAt: 2023-05-11T14:00:13.000Z
---

`POST /api/ais/v1.5/model_registration/upload`

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://api.aws.boschaishield.com/prod/api/ais/v1.5/model_registration/upload",
  "name": "Model registration",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [
      {
        "kind": "required",
        "name": "x-api-key",
        "type": "String",
        "children": [],
        "description": "Enter your API key"
      },
      {
        "kind": "required",
        "name": "Org-Id",
        "type": "String",
        "children": [],
        "description": "Enter your organization id"
      }
    ],
    "bodyDataParameters": [
      {
        "name": "task_type",
        "kind": "required",
        "type": "string",
        "description": "Enter the name of the task type",
        "children": []
      },
      {
        "name": "analysis_type",
        "kind": "required",
        "type": "string",
        "description": "Enter the name of the analysis type",
        "children": []
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "hSUK1xBPtzdznmhzmPprP",
        "code": "// Returns a JSON object containing a unique model ID and URLs to upload required files.",
        "language": "200",
        "customLabel": ""
      },
      {
        "id": "HKv5X2EmhgwF7TNx8I0hi",
        "code": "// Returns an error message if the provided API key or Org-ID is invalid or expired.",
        "language": "401",
        "customLabel": ""
      },
      {
        "id": "aTEZrqZETJE4hWhVwXWYU",
        "code": "// Returns an error message if the application cannot or will not process the request due to something that is perceived to be a client error (for example, malformed request syntax, invalid request message framing, etc.).",
        "language": "400",
        "customLabel": ""
      },
      {
        "id": "y0GaITZN0HBUWyh0nGXjF",
        "code": "// Returns an error message if access to the target resource has been denied (for example, if any of the parameter value is incorrect or license has expired).",
        "language": "412",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "hSUK1xBPtzdznmhzmPprP"
  },
  "examples": {
    "languages": [
      {
        "id": "OJTL2RNWtcse8ozCLYmCD",
        "language": "python",
        "code": "import requests\nimport json\n\nurl = \"https://api.aws.boschaishield.com/prod/api/ais/v1.5/model_registration/upload\"\n\n# please select proper payload for your usecase from request body. \npayload = {\n       'task_type':\"<<task_type>>\",\n       \"analysis_type\": \"<<analysis_type>>\"\n}\nheaders = {\n   'Accept': 'application/json',\n   'x-api-key': '########################################',\n   'Org-Id': '####################################################################################################'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, json=payload)\n\nprint(response.text)",
        "customLabel": ""
      },
      {
        "id": "Hh1J4ESuNjXCkLBQCGgh0",
        "language": "curl",
        "code": "curl --location 'https://api.aws.boschaishield.com/prod/api/ais/v1.5/model_registration/upload' \\\n--header 'x-api-key: ########################################' \\\n--header 'Org-Id: ####################################################################################################' \\\n--header 'Content-Type: application/json' \\\n--data '{\n  \"task_type\": \"<<task_type>>\",\n  \"analysis_type\": \"<<analysis_type>>\"\n}'",
        "customLabel": ""
      },
      {
        "id": "yiYfhmky0U-ZzEhP_0tI1",
        "language": "nodejs",
        "code": "var request = require('request');\nvar options = {\n  'method': 'POST',\n  'url': 'https://api.aws.boschaishield.com/prod/api/ais/v1.5/model_registration/upload',\n  'headers': {\n    'x-api-key': '########################################',\n    'Org-Id': '####################################################################################################',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\n    'task_type': '<< Enter Task Type >>',\n    'analysis_type': '<< Enter Analysis Type>>'\n  })\n\n};\nrequest(options, function (error, response) {\n  if (error) throw new Error(error);\n  console.log(response.body);\n});\n",
        "customLabel": ""
      },
      {
        "id": "F8wphHI2uSCctKBFMO9nd",
        "language": "javascript",
        "code": "var myHeaders = new Headers();\nmyHeaders.append(\"Org-id\", \"####################################################################################################\");\nmyHeaders.append(\"x-api-key\", \"########################################\");\nmyHeaders.append(\"Content-Type\", \"application/json\");\n\nvar raw = JSON.stringify({\n  \"task_type\": \"<<Enter Task Type>>\",\n  \"analysis_type\": \"<<Enter Analysis Type>>\"\n});\n\nvar requestOptions = {\n  method: 'POST',\n  headers: myHeaders,\n  body: raw,\n  redirect: 'follow'\n};\n\nfetch(\"https://api.aws.boschaishield.com/prod/api/ais/v1.5/model_registration/upload\", requestOptions)\n  .then(response => response.text())\n  .then(result => console.log(result))\n  .catch(error => console.log('error', error));",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "F8wphHI2uSCctKBFMO9nd"
  },
  "description": "The model registration API is used to register AI/ML models. It returns a unique model ID and URLs to upload the required files. We have listed the required sample files. These are the the model, data, and label files and you are required to upload them. The purpose of this API is to provide vulnerability analysis and generate customized endpoint defense to keep models secure.",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  }
}
```
:::

### Request Body

:::CodeblockTabs
IC -MEA

```json
{
        "task_type":"image_classification",
        "analysis_type": "extraction"
}
```

IC - EVA

```json
{
        "task_type":"image_classification",
        "analysis_type": "evasion"
}
```

IC - POS

```json
{
        "task_type":"image_classification",
        "analysis_type": "data-poisoning"
}
```

IS - MEA

```json
{
        "task_type":"image_segmentation",
        "analysis_type": "extraction"
}
```

TC - MEA

```json
{
        "task_type":"tabular_classification",
        "analysis_type": "extraction"
}
```

TC - EVA

```json
{
        "task_type":"tabular_classification",
        "analysis_type": "evasion"
}
```

TSF - MEA

```json
{
        "task_type":"timeseries_forecasting",
        "analysis_type": "extraction"
}
```

NLP - MEA

```json
{
       "task_type":"nlp_classification",
       "analysis_type": "extraction"
}
```

TS - MEA

```json
{
        "task_type":"timeseries_forecasting",
        "analysis_type": "extraction"
}
```

OD-EVA

```python
{
        "task_type":"object_detection",
        "analysis_type": "evasion"
}
```
:::

The request body is a JSON object with the following fields:

:::hint{type="info"}
- `task_type`: The name of the task type. Possible values are `IC` (Image Classification, `IS` (Image Segmentation), `TC` (Tabular Classification), `TSF` (Time Series Forecasting), `Text`  (NLP classification).&#x20;
- `analysis_type`: The name of the analysis type. Possible values are `MEA` (Model Extraction Attack), `EVA` (Model Evasion Attack), and `data-poisoning` or `poisoning` for (data poisoning) and `model-poisoning` for (model poisoning).
:::

### Model Upload Option

`POST /ais/v1.5/model_registration/upload`

After receiving the unique model ID and URLs from the vulnerability analysis API, users can upload the required data and track the progress further.

Note: **All files uploaded to the specified URL should be in zipped format.** This only needs to be done once for any model and multiple analyses can be performed. Check [Image Classification](docId:6DEIiMJnkL5D0cdWSTCKb), [Image Segmentation](docId\:ZGifJwp4yRvB4Uog5-Qvh) [Tabular Classification](docId\:mVtLcTNKaSHPx9MzjvB62), [Time Series Forecasting](docId\:KDsa2HzsaXO0WcQIcDDc4) & [Text Recommendation (Alpha-release)](docId\:pF0-V4Ug62-akwbXCLkoZ), [Object Detection](docId\:U3g1Wca-WL4Wed67BySah) to know the file upload format.

:::hint{type="info"}
Note: The model, data, and label must be uploaded to the given link within ten minutes. For Image Classification Poisoning addition, two clean models are required.

The `model_id` must be saved by the user for future use.
:::

:::hint{type="info"}
For using Nodejs sample code, install npm package request

Given ample code for python is tested for Python version 3.7

Given Sample code for nodejs and javascript is tested for Node V20LTS 
:::



