import { TypeList } from "docs-ui"

# MedusaRequest

## Type parameters

<TypeList types={[{"name":"Body","type":"`object`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"QueryFields","type":"`object`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="MedusaRequest"/>

## Properties

<TypeList types={[{"name":"validatedBody","type":"Body","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"validatedQuery","type":"[RequestQueryFields](../medusa.RequestQueryFields/page.mdx) & QueryFields","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"fields","type":"`string`","description":"Comma-separated fields that should be included in the returned data.\nif a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields.\nwithout prefix it will replace the entire default fields.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"offset","type":"`number`","description":"The number of items to skip when retrieving a list.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"limit","type":"`number`","description":"Limit the number of items returned in the list.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"order","type":"`string`","description":"The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with `-`.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"allowedProperties","type":"`string`[]","description":"TODO: shouldn't this correspond to returnable fields instead of allowed fields? also it is used by the cleanResponseData util","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"listConfig","type":"[FindConfig](../medusa.FindConfig/page.mdx)&#60;unknown&#62;","description":"An object containing the select, relation, skip, take and order to be used with medusa internal services","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"select","type":"(`string` \\| keyof Entity)[]","description":"An array of strings, each being attribute names of the entity to retrieve in the result.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"skip","type":"`null` \\| `number`","description":"A number indicating the number of records to skip before retrieving the results.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"take","type":"`null` \\| `number`","description":"A number indicating the number of records to return in the result.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"relations","type":"`string`[]","description":"An array of strings, each being relation names of the entity to retrieve in the result.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"order","type":"[FindConfigOrder](../../types/medusa.FindConfigOrder/page.mdx)","description":"An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"withDeleted","type":"`boolean`","description":"A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"filters","type":"`Record<string, any>`","description":"Enable ORM specific defined filters","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`Record<string, any>`","description":"Enable ORM specific defined options","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"retrieveConfig","type":"[FindConfig](../medusa.FindConfig/page.mdx)&#60;unknown&#62;","description":"An object containing the select, relation to be used with medusa internal services","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"select","type":"(`string` \\| keyof Entity)[]","description":"An array of strings, each being attribute names of the entity to retrieve in the result.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"skip","type":"`null` \\| `number`","description":"A number indicating the number of records to skip before retrieving the results.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"take","type":"`null` \\| `number`","description":"A number indicating the number of records to return in the result.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"relations","type":"`string`[]","description":"An array of strings, each being relation names of the entity to retrieve in the result.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"order","type":"[FindConfigOrder](../../types/medusa.FindConfigOrder/page.mdx)","description":"An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"withDeleted","type":"`boolean`","description":"A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"filters","type":"`Record<string, any>`","description":"Enable ORM specific defined filters","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"options","type":"`Record<string, any>`","description":"Enable ORM specific defined options","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"remoteQueryConfig","type":"`object`","description":"An object containing fields and variables to be used with the remoteQuery","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"fields","type":"`string`[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"pagination","type":"`object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"filterableFields","type":"QueryFields","description":"An object containing the fields that are filterable e.g `{ id: Any<String> }`","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"errors","type":"`string`[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"scope","type":"[MedusaContainer](../../types/medusa.MedusaContainer/page.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"includes","type":"`Record<string, boolean>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"allowed","type":"`string`[]","description":"An array of fields and relations that are allowed to be queried, this can be set by the\nconsumer as part of a middleware and it will take precedence over the req.allowed set\nby the api","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"session","type":"`any`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"rawBody","type":"`any`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"requestId","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"restrictedFields","type":"[RestrictedFields](../../classes/medusa.RestrictedFields/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"#private","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"pricingContext","type":"[MedusaPricingContext](../../types/medusa.MedusaPricingContext/page.mdx)","description":"An object that carries the context that is used to calculate prices for variants","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"region_id","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"currency_code","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"customer_id","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"customer","type":"`object`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"context","type":"`Record<string, any>`","description":"A generic context object that can be used across the request lifecycle","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"additionalDataValidator","type":"ZodOptional&#60;ZodNullable&#60;ZodObject&#60;any, any, ZodTypeAny, object, object&#62;&#62;&#62;","description":"Custom validator to validate the `additional_data` property in\nrequests that allows for additional\\_data","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"user","type":"`object`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"customer_id","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"userId","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="MedusaRequest"/>
