> For the complete documentation index, see [llms.txt](https://docs.flowretail.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flowretail.com/docs/developers/api-documentation/import/process-or-simulate-import.md).

# Process or simulate import

This will create and return a new import file record with state `NOT_STARTED` and the `importFileUid`. The validation and import is processed in a new thread that will update the import progress every 5 seconds. To fetch the current state, use the `Get import-file details` endpoint.

Use action `PROCESS` to commit the import upon validation. If no errors occur the import state is `COMPLETE`.

Use action `SIMULATE` if you do not want to commit the import data and only validat. If no errors occur the import state will be `READY_TO_IMPORT`.

Use the `Execute import content` endpoint to abort the processing or to commit (execute) a successful simulation.

Required permissions: IMPORT

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Import","description":"Import"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"ImportFileDataResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportFileDataResponseSchema"}}}}},"schemas":{"ImportFileDataResponseSchema":{"title":"ImportFileDataResponseSchema","type":"object","properties":{"templateUid":{"$ref":"#/components/schemas/UID"},"base64Data":{"type":"string"},"contentType":{"type":"string"},"action":{"$ref":"#/components/schemas/ImportActionENUM"},"importFileUid":{"$ref":"#/components/schemas/OptionalUID"},"operation":{"$ref":"#/components/schemas/ImportOperationENUM"},"state":{"$ref":"#/components/schemas/ImportStateENUM"}},"required":["templateUid","base64Data","contentType","action","importFileUid","operation","state"]},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"ImportActionENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| SIMULATE | Do a simulate on import. Return content without saving |\n| PROCESS | Process file with given template. Save file if no errors|\n","minLength":1,"title":"ImportActionENUM","type":"string","enum":["SIMULATE","PROCESS"]},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"ImportOperationENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| INSERT | Only insert non-existing records, existing records will be ignored|\n| UPDATE | Only update existing records, non-existing records will be ignored|\n| UPSERT | non-existing records will be inserted, existing records will be updated|\n","minLength":1,"title":"ImportOperationENUM","type":"string","enum":["INSERT","UPDATE","UPSERT"]},"ImportStateENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NOT_STARTED | Import not started |\n| IMPORT_IN_PROGRESS | Import is running |\n| IMPORT_ABORT | Import is aborting| \n| IMPORT_ABORTED | Import has been aborted |\n| VALIDATE_IN_PROGRESS | Validate is running| \n| COMPLETE_NOTHING_TO_IMPORT | Import is done, but there where nothing to import |\n| COMPLETE | Import complete |\n| VALIDATE_FAILED | Validate failed |\n| IMPORT_FAILED | Import failed |\n| IMPORT_ABORT | Import is aborting |\n| IMPORT_ABORTED | Import has been aborted  |\n| READY_TO_IMPORT | Validation OK, import is ready |\n","minLength":1,"title":"ImportStateENUM","type":"string","enum":["NOT_STARTED","COMPLETE","COMPLETE_NOTHING_TO_IMPORT","IMPORT_FAILED","IMPORT_ABORT","IMPORT_ABORTED","VALIDATE_FAILED","VALIDATE_ABORT","VALIDATE_ABORTED","IMPORT_IN_PROGRESS","VALIDATE_IN_PROGRESS","READY_TO_IMPORT"]},"ImportFileRequestSchema":{"title":"ImportFileRequestSchema","type":"object","properties":{"templateUid":{"$ref":"#/components/schemas/UID"},"base64Data":{"type":"string","description":"base64 encoded data to be processed"},"operation":{"$ref":"#/components/schemas/ImportOperationENUM"},"action":{"$ref":"#/components/schemas/ImportActionENUM"},"importFileUid":{"$ref":"#/components/schemas/UID"}},"required":["templateUid","base64Data","operation","action"]}},"requestBodies":{"ImportFileRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportFileRequestSchema"}}}}}},"paths":{"/tenants/{tenantUid}/imports/files":{"post":{"summary":"Process or simulate import","operationId":"post-tenants-imports-files","responses":{"200":{"$ref":"#/components/responses/ImportFileDataResponse"}},"description":"This will create and return a new import file record with state `NOT_STARTED` and the `importFileUid`.\nThe validation and import is processed in a new thread \nthat will update the import progress every 5 seconds. \nTo fetch the current state, use the `Get import-file details` endpoint.\n\nUse action `PROCESS` to commit the import upon validation. \nIf no errors occur the import state is `COMPLETE`.\n\nUse action `SIMULATE` if you do not want to commit the import data and only validat. \nIf no errors occur the import state will be `READY_TO_IMPORT`.\n\nUse the `Execute import content` endpoint to abort the processing or \nto commit (execute) a successful simulation.\n\nRequired permissions: IMPORT\n","requestBody":{"$ref":"#/components/requestBodies/ImportFileRequest"},"tags":["Import"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flowretail.com/docs/developers/api-documentation/import/process-or-simulate-import.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
