The API is self describing in that it provides metadata about the various fields available at any given endpoint. External applications (such as the python interface) can introspect the API to determine information about the model fields.
The various forms implemented in the InvenTree web interface make heavy use of this metadata feature
To request metadata about a particular API endpoint, simply perform an
OPTIONS method request against the API URL.
For example, to view the metadata available for creating a new Part Category, an
OPTIONS request to
You can see here a detailed list of the various fields which are available for this API endpoint.
OPTIONS endpoint provides the following information:
|The human-readable name of the API endpoint
|Descriptive detail for the endpoint, extracted from the python docstring
|Contains the available HTTP actions and field information (see below)
Specific details are provided on the available attributes of each field:
Supported field types are:
|true / false value
|Floating point numbers
|Primary key value for a foreign-key relationship in the database
Each named field provides information on available attributes:
|Defines the field type
|The default value for this field. Will be assumed if no value is supplied
|Boolean value, whether this field must be supplied
|Boolean value, whether this field is writeable
|Human readable descriptive label for this field.
|Long form descriptor for this field.
|Minimum allowed value (for numeric fields)
|Maximum allowed value (for numeric fields)
|Maximum allowed length (for text fields)
|Name of the database model, if this field represents a foreign-key relationship
|API url for the related model, if this field represents a foreign-key relationship
|API filters for the field, if this field represents a foreign-key relationship
The field name is the key used to define the field itself
Some attributes may not be made available for a particular field
Field label and help text values are localized using the community contributed translations. The required locale information is determined from the API request itself, meaning that the translated values are provided automatically.
For example, the same forms (in the web interface) are served via identical API requests, with the locale information determined "on the fly":