# Create a classifier POST /v1/a/adapters/ids/classifier Select code sample ``` const url = 'https://example.com/v1/a/adapters/ids/classifier'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"model_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","description":"example","intent":{"intents":[{"id":"example","description":"example","phrase":{"phrases":["example"]}}]}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ``` curl --request POST \ --url https://example.com/v1/a/adapters/ids/classifier \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "model_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "description": "example", "intent": { "intents": [ { "id": "example", "description": "example", "phrase": { "phrases": [ "example" ] } } ] } }' ``` - /v1/a/adapters/ids/classifier Records a new classifier at its first version (`0`) owned by the account, and queues its training. Later content changes are saved with `PUT /v1/classifier/{id}/account/{account_sid}`, which records the next version rather than altering this one. ## Permission This operation needs the permission [`ids:classifier:manage`](https://docs.aiva.apifonica.com/concepts/roles-and-permissions/#ids-classifier-manage). ## Authorizations - **[bearerAuth](https://docs.aiva.apifonica.com/api/account/#bearerauth)** ## Parameters ### Header Parameters **X-Account-Sid** string Target account for principals broader than one account (tenant / account API key); account-scoped principals use their own. ## Request Bodyrequired Media typeapplication/json Training-relevant content of a classifier. object **model\_id** required string format: uuid **description** string <= 1024 characters **intent** required object **intents** required Array\ object **id** required string <= 36 characters **description** string <= 1024 characters **phrase** required object **phrases** required Array\ \>= 1 items ##### Examplegenerated ``` { "model_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "description": "example", "intent": { "intents": [ { "id": "example", "description": "example", "phrase": { "phrases": [ "example" ] } } ] } } ``` ## Responses ### 201 Created Media typeapplication/json One immutable version of a classifier, addressed by the account, the classifier id and the version number. object **id** required string **version** required Version number. `0` is an ordinary version like any other — the first one a classifier gets, and the one existing scenario bricks name. integer **account\_sid** required string **model\_id** required string **description** required string **intent** required object **intents** required Array\ object **id** required string <= 36 characters **description** string <= 1024 characters **phrase** required object **phrases** required Array\ \>= 1 items **content\_hash** required Identity of this version’s training-relevant content. Two versions of one classifier can never carry the same value; it is what lets identical content resolve to an existing version instead of training again. string **state** required string Allowed values: new training fail success unknown **training** Why the last training run of this version ended as it did. Present on a single-version read; absent from list entries. object **error** Why the last training run failed. Absent unless it failed. string **created\_at** When the training run was queued. Absent if none was ever queued. string format: date-time **updated\_at** When the training run last changed state. Absent if none was ever queued. string format: date-time ##### Example ``` { "state": "new" } ``` ### 400 Bad request Media typeapplication/json object **name** required string **message** required string **code** required integer **status** required integer ##### Examplegenerated ``` { "name": "example", "message": "example", "code": 1, "status": 1 } ``` ### 401 Unauthorized ### 403 Forbidden ### 500 Internal server error Media typeapplication/json object **name** required string **message** required string **code** required integer **status** required integer ##### Examplegenerated ``` { "name": "example", "message": "example", "code": 1, "status": 1 } ``` ### 502 Bad gateway (upstream adapter error)