> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# GetLoyaltyImport

# Package: accounts

# Namespace: LoyaltyImports

# Method link: https://dev.wix.com/docs/api-reference/crm/loyalty-program/accounts/imports/get-loyalty-import.md

## Permission Scopes:
Manage Loyalty: SCOPE.DC-LOYALTY.MANAGE-LOYALTY

## Introduction

Retrieves a loyalty import.

---

## REST API

### Schema

```
 Method: getLoyaltyImport
 Description: Retrieves a loyalty import.
 URL: https://www.wixapis.com/_api/loyalty-imports/v1/loyalty-imports
 Method: GET
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  loyaltyImportId
 Method parameters: 
   query param name: loyaltyImportId | type: loyaltyImportId | description: Loyalty import GUID. | required: true 
 Return type: GetLoyaltyImportResponse
  - name: loyaltyImport | type: LoyaltyImport | description: Retrieved loyalty import.  
     - name: id | type: string | description: The GUID of the import.  | read-only: true | validation: format GUID
     - name: asyncImportJobId | type: string | description: GUID of the asynchronous import job associated with this import.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the loyalty import is updated. To prevent conflicting changes, the current `revision` must be passed when updating the loyalty import.  Ignored when creating a loyalty import.  | read-only: true | validation: format int64
     - name: createdDate | type: string | description: Date and time the loyalty import was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the loyalty import was last updated.  | read-only: true | validation: format date-time
     - name: status | type: ImportStatus | description: Current status of the import process.  | read-only: true 
         - enum:
         -     UNKNOWN: Status is unknown or not specified.
         -     INITIATED: The import has initiated but processing hasn't started yet.
         -     PARSING: The system is currently parsing the import file.
         -     PARSED: The import file has been successfully parsed and is ready to import.
         -     IMPORTING: The system is currently importing the parsed data.
         -     IMPORTED: The import process is complete. This status indicates the process finished, but doesn't guarantee all data imported successfully.
         -     FAILED: The import process has failed.
     - name: fileMetadata | type: FileMetadata | description: Metadata of the uploaded file containing loyalty points data.  
        - name: size | type: integer | description: Size of the uploaded file in bytes. Max: `10 MB`.  | read-only: true | validation: maximum 104857600, format int32
        - name: name | type: string | description: Name of the uploaded file.  | read-only: true | validation: format GUID
        - name: url | type: string | description: URL of the uploaded file.  | validation: minLength 3, maxLength 10000
        - name: header | type: FileHeader | description: Column headings from the first row of the uploaded CSV file.  
           - name: values | type: array<string> | description: Column headings from the first row of the uploaded file.  | validation: maxItems 100, maxLength 1000
        - name: headerMappingInfo | type: HeaderMappingInfo | description: Mapping between loyalty data fields and the corresponding columns in the uploaded file.  Must include mappings for both `EMAIL` and `POINTS` to be valid.  
           - name: headerMappings | type: array<HeaderMapping> | description: Mappings between required loyalty data fields and file columns. Must contain exactly 2 mappings: one for `"EMAIL"` and one for `"POINTS"`.  | validation: minItems 2, maxItems 2
              - name: columnName | type: ColumnName | description: The required loyalty data field that this mapping corresponds to. Must be either `"EMAIL"` or `"POINTS"`.  
                     - enum:
                     -     EMAIL: Column containing the customer's email address.
                     -     POINTS: Column containing the customer's loyalty point balance to be imported or updated.
              - name: columnIndex | type: integer | description: The zero-based index of the column in the uploaded file that contains the data for this loyalty field. For example, if the email addresses are in the second column of the CSV file, this value would be `1`.  
        - name: sampleDataRows | type: array<SampleDataRow> | description: Up to 5 sample rows from the import file, providing a preview of the data to be imported.  | validation: maxItems 5
           - name: values | type: array<string> | description: Values in one sample data row. Each value corresponds to a column in the CSV file. The number of values matches the number of columns in the file.  | validation: maxItems 20, maxLength 1000
     - name: parseResult | type: ParseResult | description: Results of parsing the uploaded file, including the number of rows parsed and any parse errors.  
        - name: parsedRowCount | type: integer | description: Number of rows parsed from the uploaded import file.  | read-only: true | validation: format int32
        - name: parseErrorReason | type: string | description: Reason code explaining why parsing failed, if applicable.  | read-only: true | validation: maxLength 1000
     - name: importResult | type: ImportResult | description: Results of the import process, including success and failure counts.  
        - name: errorFileExists | type: boolean | description: Whether an error file detailing import failures is available for download. The file includes row-by-row import status, error reasons, and original data.  
        - name: successCount | type: integer | description: Number of rows successfully imported.  | read-only: true | validation: format int32
        - name: failureCount | type: integer | description: Number of rows that failed to import due to errors.  | read-only: true | validation: format int32


```

### Examples

### Get Loyalty import (IMPORTED)
```curl
curl -X GET \
  'https://www.wixapis.com/_api/loyalty-imports/v1/loyalty-imports?loyaltyImportId=5cc0b472-e488-4de3-92ba-bd718a44933a' \
  -H 'Authorization: <AUTH>' \
  -H 'Content-Type: application/json'
```

### Get Loyalty import (PARSED)
```curl
curl -X GET \
  'https://www.wixapis.com/_api/loyalty-imports/v1/loyalty-imports?loyaltyImportId=5cc0b472-e488-4de3-92ba-bd718a44933a' \
  -H 'Authorization: <AUTH>' \
  -H 'Content-Type: application/json'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.loyalty.imports.getLoyaltyImport(loyaltyImportId)
 Description: Retrieves a loyalty import.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  loyaltyImportId
 Method parameters: 
   param name: loyaltyImportId | type: string | description: Loyalty import GUID. | required: true 
 Return type: PROMISE<LoyaltyImport>
  - name: _id | type: string | description: The GUID of the import.  | read-only: true | validation: format GUID
  - name: asyncImportJobId | type: string | description: GUID of the asynchronous import job associated with this import.  | read-only: true | validation: format GUID
  - name: revision | type: string | description: Revision number, which increments by 1 each time the loyalty import is updated. To prevent conflicting changes, the current `revision` must be passed when updating the loyalty import.  Ignored when creating a loyalty import.  | read-only: true | validation: format int64
  - name: _createdDate | type: Date | description: Date and time the loyalty import was created.  | read-only: true 
  - name: _updatedDate | type: Date | description: Date and time the loyalty import was last updated.  | read-only: true 
  - name: status | type: ImportStatus | description: Current status of the import process.  | read-only: true 
     - enum:
     -     UNKNOWN: Status is unknown or not specified.
     -     INITIATED: The import has initiated but processing hasn't started yet.
     -     PARSING: The system is currently parsing the import file.
     -     PARSED: The import file has been successfully parsed and is ready to import.
     -     IMPORTING: The system is currently importing the parsed data.
     -     IMPORTED: The import process is complete. This status indicates the process finished, but doesn't guarantee all data imported successfully.
     -     FAILED: The import process has failed.
  - name: fileMetadata | type: FileMetadata | description: Metadata of the uploaded file containing loyalty points data.  
     - name: size | type: integer | description: Size of the uploaded file in bytes. Max: `10 MB`.  | read-only: true | validation: maximum 104857600, format int32
     - name: name | type: string | description: Name of the uploaded file.  | read-only: true | validation: format GUID
     - name: url | type: string | description: URL of the uploaded file.  | validation: minLength 3, maxLength 10000
     - name: header | type: FileHeader | description: Column headings from the first row of the uploaded CSV file.  
        - name: values | type: array<string> | description: Column headings from the first row of the uploaded file.  | validation: maxItems 100, maxLength 1000
     - name: headerMappingInfo | type: HeaderMappingInfo | description: Mapping between loyalty data fields and the corresponding columns in the uploaded file.  Must include mappings for both `EMAIL` and `POINTS` to be valid.  
        - name: headerMappings | type: array<HeaderMapping> | description: Mappings between required loyalty data fields and file columns. Must contain exactly 2 mappings: one for `"EMAIL"` and one for `"POINTS"`.  | validation: minItems 2, maxItems 2
           - name: columnName | type: ColumnName | description: The required loyalty data field that this mapping corresponds to. Must be either `"EMAIL"` or `"POINTS"`.  
                 - enum:
                 -     EMAIL: Column containing the customer's email address.
                 -     POINTS: Column containing the customer's loyalty point balance to be imported or updated.
           - name: columnIndex | type: integer | description: The zero-based index of the column in the uploaded file that contains the data for this loyalty field. For example, if the email addresses are in the second column of the CSV file, this value would be `1`.  
     - name: sampleDataRows | type: array<SampleDataRow> | description: Up to 5 sample rows from the import file, providing a preview of the data to be imported.  | validation: maxItems 5
        - name: values | type: array<string> | description: Values in one sample data row. Each value corresponds to a column in the CSV file. The number of values matches the number of columns in the file.  | validation: maxItems 20, maxLength 1000
  - name: parseResult | type: ParseResult | description: Results of parsing the uploaded file, including the number of rows parsed and any parse errors.  
     - name: parsedRowCount | type: integer | description: Number of rows parsed from the uploaded import file.  | read-only: true | validation: format int32
     - name: parseErrorReason | type: string | description: Reason code explaining why parsing failed, if applicable.  | read-only: true | validation: maxLength 1000
  - name: importResult | type: ImportResult | description: Results of the import process, including success and failure counts.  
     - name: errorFileExists | type: boolean | description: Whether an error file detailing import failures is available for download. The file includes row-by-row import status, error reasons, and original data.  
     - name: successCount | type: integer | description: Number of rows successfully imported.  | read-only: true | validation: format int32
     - name: failureCount | type: integer | description: Number of rows that failed to import due to errors.  | read-only: true | validation: format int32


```

### Examples

### getLoyaltyImport
```javascript
import { imports } from '@wix/loyalty';

async function getLoyaltyImport(loyaltyImportId) {
  const response = await imports.getLoyaltyImport(loyaltyImportId);
};
```

### getLoyaltyImport (with elevated permissions)
```javascript
import { imports } from '@wix/loyalty';
import { auth } from '@wix/essentials';

async function myGetLoyaltyImportMethod(loyaltyImportId) {
  const elevatedGetLoyaltyImport = auth.elevate(imports.getLoyaltyImport);
  const response = await elevatedGetLoyaltyImport(loyaltyImportId);
}
```

### getLoyaltyImport (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { imports } from '@wix/loyalty';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { imports },
  // Include the auth strategy and host as relevant
});


async function getLoyaltyImport(loyaltyImportId) {
  const response = await myWixClient.imports.getLoyaltyImport(loyaltyImportId);
};
```

---