> For the complete documentation index, see [llms.txt](https://synconics.gitbook.io/rest-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://synconics.gitbook.io/rest-api/inspection-and-introspection/ir.model.md).

# ir.model

Provides information about Odoo models via its various fields

**name**

a human-readable description of the model

**model**

the name of each model in the system

**state**

whether the model was generated in Python code (<mark style="color:orange;">`base`</mark>) or by creating an <mark style="color:orange;">`ir.model`</mark> record (<mark style="color:orange;">`manual`</mark>)

**field\_id**

list of the model’s fields through a [One2many](https://www.odoo.com/documentation/16.0/developer/reference/backend/orm.html#odoo.fields.One2many) to [ir.model.fields](/rest-api/inspection-and-introspection/ir.model.fields.md)

**view\_ids**

[One2many](https://www.odoo.com/documentation/16.0/developer/reference/backend/orm.html#odoo.fields.One2many) to the [Views](https://www.odoo.com/documentation/16.0/developer/reference/backend/views.html) defined for the model

**access\_ids**

[One2many](https://www.odoo.com/documentation/16.0/developer/reference/backend/orm.html#odoo.fields.One2many) relation to the [Access Control](https://www.odoo.com/documentation/16.0/developer/reference/backend/security.html#access-rights) set on the model

<mark style="background-color:blue;">**Note**</mark>

<mark style="background-color:blue;">`ir.model`</mark> <mark style="background-color:blue;"></mark><mark style="background-color:blue;">can be used to:</mark>

* <mark style="background-color:blue;">query the system for installed models (as a precondition to operations on the model or to explore the system’s content)</mark>
* <mark style="background-color:blue;">get information about a specific model (generally by listing the fields associated with it)</mark>
* <mark style="background-color:blue;">create new models dynamically over REST API</mark>

<mark style="background-color:orange;">**Warning**</mark>

* <mark style="background-color:orange;">**custom**</mark> <mark style="background-color:orange;"></mark><mark style="background-color:orange;">model names must start with</mark> <mark style="background-color:orange;"></mark><mark style="background-color:orange;">`x_`</mark>
* <mark style="background-color:orange;">the</mark> <mark style="background-color:orange;"></mark><mark style="background-color:orange;">`state`</mark> <mark style="background-color:orange;"></mark><mark style="background-color:orange;">must be provided and</mark> <mark style="background-color:orange;"></mark><mark style="background-color:orange;">`manual`</mark><mark style="background-color:orange;">, otherwise, the model will not be loaded</mark>
* <mark style="background-color:orange;">it is not possible to add new</mark> <mark style="background-color:orange;"></mark>*<mark style="background-color:orange;">methods</mark>* <mark style="background-color:orange;"></mark><mark style="background-color:orange;">to a custom model, only fields</mark><br>

**Example**

Create <mark style="color:orange;">`x_custom_model`</mark> model record in <mark style="color:orange;">`ir.model`</mark> object using [Create Records](/rest-api/calling-methods/create-records.md) API endpoint.

**Request:**

```
POST /restapi/1.0/object/ir.model?vals={'name':'Custom Model','model':'x_custom_model','state':'manual'} HTTP/1.1
Host: {your_Odoo_server_url}

```

**JSON Response**:

```
HTTP/1.1 200 OK

{
  'Models': {
      'id': 104,
      'name': 'Custom Model',
      'model': 'x_custom_model',
      'state': 'manual'
      ...
      ...
      ...
  }
}
```

**XML Response:**

```
HTTP/1.1 200 OK

<Models type="dict">
	<id type="int">104</id>
	<name type="str">Custom Model</name>
	<model type="str">x_custom_model</model>
	<state type="str">manual</state>
</Models>
```

2. Inspect a model <mark style="color:orange;">`x_custom_model`</mark>’s fields using the [Listing Record Fields](/rest-api/calling-methods/listing-record-fields.md) API endpoint.

**Request:**

```
GET /restapi/1.0/object/x_custom_model/fields_get?attributes=['string','help','type'] HTTP/1.1
Host: {your_Odoo_server_url}
```

**JSON Response:**

<mark style="background-color:blue;">**Note**</mark>

<mark style="background-color:blue;">a custom model will initially contain only the “built-in” fields available on all models</mark>

```
 HTTP/1.1 200 OK

 {
   'fields': {
       'create_uid': {
           'type': 'many2one',
           'string': 'Created by'
       },
       'create_date': {
           'type": 'datetime',
           'string': 'Created on'
       },
       '__last_update': {
           'type': 'datetime',
           'string': 'Last Modified on'
       },
       'write_uid': {
           'type': 'many2one',
           'string': 'Last Updated by'
       },
       'write_date': {
           'type': 'datetime',
           'string': 'Last Updated on'
       },
       'display_name': {
           'type': 'char',
           'string': 'Display Name'
       },
       'id": {
           'type': 'integer',
           'string': 'Id'
       }
   }
}
```

**XML Response:**

```
HTTP/1.1 200 OK

<fields type="dict">
	<create_uid type="dict">
		<type type="str">many2one</type>
		<string type="str">Created by</string>
	</create_uid>
	<create_date type="dict">
		<type type="str">datetime</type>
		<string type="str">Created on</string>
	</create_date>
	<__last_update type="dict">
		<type type="str">datetime</type>
		<string type="str">Last Modified on</string>
	</__last_update>
	<write_uid type="dict">
		<type type="str">many2one</type>
		<string type="str">Last Updated by</string>
	</write_uid>
	<write_date type="dict">
		<type type="str">datetime</type>
		<string type="str">Last Updated on</string>
	</write_date>
	<display_name type="dict">
		<type type="str">char</type>
		<string type="str">Display Name</string>
	</display_name>
	<id type="dict">
		<type type="str">integer</type>
		<string type="str">Id</string>
	</id>
</fields>
```
