Beta feature

Add properties to body data with an API collection

Types in collections is a beta feature available with Postman Professional plans.

You can add body data to your API requests to send a data payload along with the request. You can also add a response body to saved request examples to show valid responses for different use cases. After you turn on types in a collection, you can generate a schema from the raw (JSON) body for a request or from the response body for a saved example. You can then add more details to properties in the schema like a default value or description. Details you add will appear in the collection's documentation.

As you work on requests, Postman suggests and autocompletes values based on the body schema. Postman also identifies any issues and possible fixes.

Add body data properties

To generate a schema from body data, do the following:

  1. Turn on types for your collection.

  2. Choose one of the following options:

    • Open a request and select the Body tab, then select the raw option. Make sure JSON is selected in the format dropdown list.
    • Open a saved example and, in the response pane, select the Body tab and make sure JSON is selected in the format dropdown list.
  3. Add JSON body data to the request or add a JSON response body to the saved example as needed.

  4. Select Schema in the workbench to show the schema pane.

    View body schema

  5. Select Generate from Body. Postman automatically generates a schema based on the existing body data.

    Generate body schema

  6. Add more properties to the schema if you'd like.

  7. Select Save icon Save to save the changes to your request or saved example.

Edit and validate body data

After generating a schema from body data, Postman offers autocomplete suggestions as you edit body data. Postman suggests properties and valid values based on the body schema.

Postman also checks keys and values you enter in the body data against the body schema. If the value isn't valid, Postman will flag the issue in the body data with an orange underline. Hover over the underlined code to view a tooltip about the issue and a possible fix. This enables you to fix any issues before you send the request.

Body data autocomplete

Add more properties to the body schema to add more autocomplete suggestions and flag more issues:

Add type properties

You can add the type for a property in the schema. In the schema pane, add a new key-value pair with type as the key and the data type as the value.

The property accepts the following values: array, boolean, integer, null, number, object, and string.

"baseUrl": {
    "type": "string",
    "format": "uri"
}

If a property doesn't match the specified data type, Postman will flag the issue with an orange underline. Hover over the underlined code to view a tooltip with the allowed values.

Add format properties

You can add the data format for a string in the schema. In the schema pane, add a new key-value pair with format as the key and the data format as the value.

The property accepts the following values: date, date-time, time, duration, email, hostname, ipv4, ipv6, uri, uuid, regex, json-pointer, and relative-json-pointer.

"baseUrl": {
    "type": "string",
    "format": "uri"
}

If a property doesn't match the specified data format, Postman will flag the issue with an orange underline. Hover over the underlined code to view a tooltip with the allowed values.

Add descriptions

You can add descriptions to properties in the schema. Descriptions help others understand the purpose and usage of each property.

For each property in the schema pane, add a new key-value pair with description as the key and the property's description as the value.

"baseUrl": {
    "type": "string",
    "format": "uri",
    "description": "The base URL of the service"
}

When you hover over a property in the body of the request or saved example, the description appears as a tooltip.

View property tooltip

Add required properties

If one or more properties in the body are required, you can specify this in the generated schema. In the schema pane, add a new key-value pair with required as the key and a comma-separated list of the required properties as the value.

{
    "type": "object",
    "properties": {
        "enabled": {
            "type": "boolean",
            "description": "The status of the service"
        },
        "baseUrl": {
            "type": "string",
            "format": "uri",
            "description": "The base URL of the service"
        },
    },
    "required": ["enabled", "baseUrl"]
}

If a required property is missing from the body data, Postman will flag the issue with an orange underline. Hover over the underlined code to view a tooltip about the issue.

Add deprecated properties

If a property is deprecated, you can specify this in the generated schema. A deprecated property is still functional, but its usage is discouraged because support may be discontinued.

In the schema pane, add a new key-value pair with deprecated as the key and a boolean value ("true" or "false").

"baseUrl": {
    "type": "string",
    "format": "uri",
    "deprecated": true
}

Add default values

If a property has a default value, you can specify this in the generated schema.

"baseUrl": {
    "type": "string",
    "format": "uri",
    "default": "https://wwww.example.com"
}

When you select the autocomplete suggestion for a property, the default value will be automatically added to the request body.

Add enum properties

If a property has one or more allowed values, you can specify this in the generated schema. In the schema pane, add a new key-value pair with enum as the key and a comma-separated list of the allowed values as the value.

"baseUrl": {
    "type": "string",
    "format": "uri",
    "enum": ["http://wwww.example.com", "www.example.com"]
}

If a property isn't using one of the allowed values in the body data, Postman will flag the issue with an orange underline. Hover over the underlined code to view a tooltip with the allowed values.

Add pattern properties

You can add allowed data patterns for a string using regex (regular expressions). In the schema pane, add a new key-value pair with pattern as the key and a regular expression as the value.

"baseUrl": {
    "type": "string",
    "pattern": "^https"
}

If a property doesn't match the format specified in the regular expression, Postman will flag the issue with an orange underline. Hover over the underlined code to view a tooltip about the issue.

Add minimum and maximum lengths

You can add the minimum and maximum amount of characters for a string in the schema. In the schema pane, add a new key-value pair with minLength or maxLength as the key and a non-negative integer as the value.

"baseUrl": {
    "type": "string",
    "format": "uri",
    "minLength": 15,
    "maxLength": 25
}

If a property has too many or too few characters according to the specified length, Postman will flag the issue with an orange underline. Hover over the underlined code to view a tooltip about the issue.

Add minimum and maximum values

You can add the minimum and maximum values for an integer or number in the schema. In the schema pane, add a new key-value pair with minimum or maximum as the key and a number as the value.

"age": {
    "type": "number",
    "minimum": 0,
    "maximum": 45
}

If a property is greater than or less than the specified value, Postman will flag the issue with an orange underline. Hover over the underlined code to view a tooltip about the issue.

Last modified: 2025/03/05