Skip to content

Submissions Tool Vista Import

The vista-import endpoint uploads a Vista ZIP package, validates the current MHRA session, processes the archive, and starts importing the products into MHRA.

The endpoint can also send one final email summary after all products created from the ZIP finish their asynchronous import processing.

Swagger UI documentation for this endpoint is available at: https://api.submissions-tool.mavryx.emartsynergia.com/api/doc#/Vista%20Import/post_mhra_vista_import.

Endpoint

POST {SUBMISSIONS_TOOL_BASE_URL}/mhra/vista-import

Authorization

See Authorization Overview for the standard authentication flow.

Swagger UI documentation for authorization is available at: https://iam.mavryx.docker/api/doc#/Authentication/postLogin

Request Requirements

The request must use multipart/form-data and include:

  • file - required ZIP archive
  • comment - optional import comment
  • email - optional notification recipient address

Validation and processing rules:

  • only files with the .zip extension are accepted
  • the maximum allowed file size is 2048 MB
  • the endpoint requires an active MHRA session; otherwise it returns 412 Precondition Failed
  • the ZIP is processed immediately after upload
  • products found in the package are automatically sent into the import process

ZIP Structure

The current importer expects a ZIP with a single top-level root directory and an export directory inside it:

<root>/export/...

Example accepted layout:

package-name/
  export/
    attachments/
    ecigarette-product-submissions/
    submitters/

If the archive contains multiple top-level directories, the API returns an explicit processing error, for example:

{
  "status": "error",
  "message": "Invalid submission ZIP: expected a single root directory but found multiple: data, export"
}

Example Request

curl -X POST 'https://api.submissions-tool.mavryx.emartsynergia.com/mhra/vista-import' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -F 'file=@./import-package.zip;type=application/zip' \
  -F 'comment=Vista import batch 2026-06-09' \
  -F 'email=qa@example.com'

Example request without explicit notification address:

curl -X POST 'https://api.submissions-tool.mavryx.emartsynergia.com/mhra/vista-import' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -F 'file=@./import-package.zip;type=application/zip'

In the second case the backend uses the default notification address if one is configured for the environment.

Success Response

On success, the API returns 200 OK. The response includes the stored ZIP import record, ZIP processing counters, queue enqueue results, optional notification status, and the local submissions created from the XML files.

Example response:

{
  "status": "success",
  "message": "Vista ZIP imported and queued successfully.",
  "data": {
    "id": 12,
    "comment": "Vista import batch 2026-06-09",
    "zip_file_path": "/app/var/mhra_data/zip_import_12/data.zip",
    "zip_file": {
      "uploaded_at": "2026-06-09T14:54:48.000Z",
      "size_mb": "12.34"
    },
    "zip_import": {
      "extracted_xml_files": 2,
      "skipped_count": 0,
      "created_submissions": [
        {
          "id": 101,
          "product_id": "EC-000123",
          "product_type": "Electronic cigarette - refillable",
          "status": "local"
        }
      ],
      "failed": []
    },
    "queue": {
      "queued_count": 1,
      "failed_count": 0,
      "results": [
        {
          "submission_id": 101,
          "ok": true,
          "status": 202,
          "message": "Task queued.",
          "data": {
            "job_id": "0d7c3d7d-aef7-4b5e-a90b-7cb4b9d6318e",
            "run_process": "mhra-insert",
            "submission_id": 101,
            "submission_comment": "Vista import batch 2026-06-09"
          }
        }
      ]
    },
    "notification": {
      "email": "qa@example.com",
      "status": "pending"
    },
    "submissions": [
      {
        "id": 101,
        "uuid": "f3f3f1a2-7b55-4c1d-9fb7-111111111111",
        "case_id": null,
        "product_id": "EC-000123",
        "zip_import_id": {
          "id": 12,
          "comment": "Vista import batch 2026-06-09"
        },
        "status": "mhra_inserting",
        "mhra_data": {
          "status": "local",
          "product_type": "Electronic cigarette - refillable",
          "submission_date": "",
          "submission_comment": "Vista import batch 2026-06-09",
          "submission_type": "",
          "modified_date": ""
        },
        "state": {
          "extracted_data": true,
          "init_validate": false,
          "product_details": false,
          "product_presentation": false,
          "design": false,
          "ingredients": false,
          "emission": false
        },
        "source": "zip",
        "created_at": "2026-06-09T14:54:49.000Z",
        "updated_at": "2026-06-09T14:54:51.000Z",
        "actions": []
      }
    ]
  }
}

notification.status can be pending, sending, sent, or error.

If the ZIP is processed but one or more XML files fail or one or more submissions cannot be queued, the endpoint still returns 200 OK with a partial result message and per-item details:

{
  "status": "success",
  "message": "Vista ZIP processed with partial results. Added: 1, skipped: 1, failed: 1, queued: 0, queue_failed: 1.",
  "data": {
    "id": 13,
    "comment": null,
    "zip_file_path": "/app/var/mhra_data/zip_import_13/data.zip",
    "zip_file": {
      "uploaded_at": "2026-06-09T15:12:10.000Z",
      "size_mb": "8.91"
    },
    "zip_import": {
      "extracted_xml_files": 3,
      "skipped_count": 1,
      "created_submissions": [
        {
          "id": 102,
          "product_id": "EC-000124",
          "product_type": "Electronic cigarette - disposable",
          "status": "local"
        }
      ],
      "failed": [
        {
          "xml_file": "78c24dc3-8c5a-42bd-8eb2-222222222222.xml",
          "error": "Invalid product type mapping: unknown value 999"
        }
      ]
    },
    "queue": {
      "queued_count": 0,
      "failed_count": 1,
      "results": [
        {
          "submission_id": 102,
          "ok": false,
          "status": 409,
          "message": "Submission is already queued or running.",
          "data": {
            "job_id": "a7a07988-966c-4560-8a5b-333333333333",
            "job_state": "waiting"
          }
        }
      ]
    },
    "notification": null,
    "submissions": [
      {
        "id": 102,
        "uuid": "2c15aa16-8f9d-4d1f-9d22-444444444444",
        "case_id": null,
        "product_id": "EC-000124",
        "zip_import_id": {
          "id": 13,
          "comment": null
        },
        "status": "local",
        "mhra_data": {
          "status": "local",
          "product_type": "Electronic cigarette - disposable",
          "submission_date": "",
          "submission_comment": "",
          "submission_type": "",
          "modified_date": ""
        },
        "state": {
          "extracted_data": true,
          "init_validate": false,
          "product_details": false,
          "product_presentation": false,
          "design": false,
          "ingredients": false,
          "emission": false
        },
        "source": "zip",
        "created_at": "2026-06-09T15:12:11.000Z",
        "updated_at": "2026-06-09T15:12:12.000Z",
        "actions": [
          "mhra-insert"
        ]
      }
    ]
  }
}

Error Responses

400 Bad Request

  • no file was provided
  • the uploaded file does not use the .zip extension
  • the request format is invalid
  • email is present but invalid

401 Unauthorized

  • the Authorization header is missing
  • the token is invalid or expired

403 Forbidden

  • the token is valid, but the client does not have submissions-tool.vista-import.create

412 Precondition Failed

  • no active MHRA session exists
  • the MHRA session expired
  • MHRA login is waiting for an email verification code

Example:

{
  "status": "error",
  "message": "Active MHRA session is required before Vista ZIP import.",
  "data": {
    "mhra_session_message": "No session stored."
  }
}

413 Payload Too Large

  • the uploaded ZIP file exceeds 2048 MB

500 Internal Server Error

  • the ZIP content is invalid for the importer
  • ZIP unpacking or XML processing failed
  • another server-side processing error occurred

For processing failures, the API returns the specific error message when available.