> ## Documentation Index
> Fetch the complete documentation index at: https://docs.shipstream.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Import

## Methods

* [import.search](#import-search)
* [import.info](#import-info)
* [import.create](#import-create)

***

## Entity Properties

* [Import Options](#import-options-properties)
* [Import](#import-properties)

***

## `import.search`

`import.search(null|object $filters, array $options = [])`

Retrieve list of imports. Filtration could be applied.

### Parameters

<ParamField path="filters" type="null | object">
  * `null` - Retrieve list of all imports.
  * `object` - Retrieve list of imports using specified [Search Filters](/merchant-api/search-filters).
</ParamField>

<ParamField path="options" type="array">
  * `null` - No options will be applied.
  * `object` - Apply specified [Search Options](/merchant-api/search-options).
</ParamField>

### Return Value

An array of objects. Each object will contain [Import Properties](#import-properties).

### Example Request

Get import details for one import id:

```json title="Request" theme={null}
{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "method" : "call",
    "params" : [
        "be1c13ed4e03f0ed7f1e4053dfff9658",
        "import.search",
        [
            {
                "task_id" : {
                    "eq" : 1
                }
            },
            []
        ]
    ]
}
```

### Example Response

```json title="Response" theme={null}
{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "error" : null,
    "result" : [
        {
            "task_id" : 1,
            "status" : "complete",
            "progress" : 100,
            "num_records" : 6,
            "num_parse_success" : 6,
            "num_parse_failures" : 0,
            "num_submit_success" : 1,
            "num_submit_failures" : 5
        }
    ]
}
```

### Error Codes

| code | message                                          |
| ---- | ------------------------------------------------ |
| 101  | Invalid filters given. Details in error message. |

***

## `import.info`

`import.info (string $taskId, null|object $fields = [])`

Retrieve full order information.

### Parameters

<ParamField path="taskId" type="string">
  Import unique ID.
</ParamField>

<ParamField path="fields" type="null | object">
  * `null` - Retrieve basic import properties.
  * `array` - Defined list of properties to retrieve. "records" will add records information which is excluded by default.
</ParamField>

### Return Value

Object which contains the specified (or default if no fields parameter was given) [Import Properties](#import-properties).

### Example Request

Get order information for the specified order:

```json title="Request" theme={null}
{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "method" : "call",
    "params" : [
        "be1c13ed4e03f0ed7f1e4053dfff9658",
        "import.info",
        [
            3,
            [
                "records"
            ]
        ]
    ]
}
```

### Example Response

```json title="Response" theme={null}
{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "error" : null,
    "result" : {
        "task_id" : 1,
        "status" : "complete",
        "progress" : 100,
        "num_records" : 6,
        "num_parse_success" : 6,
        "num_parse_failures" : 0,
        "num_submit_success" : 1,
        "num_submit_failures" : 5,
        "records" : [
            {
                "entity_id" : "10000045",
                "parse_status" : "valid",
                "submit_status" : "complete"
            }
        ]
    }
}
```

### Error Codes

| code | message                          |
| ---- | -------------------------------- |
| 100  | Requested import does not exist. |

***

## `import.create`

`import.create (string $data, string $entityType, null|object $options)`

Import data.

### Parameters

<ParamField path="data" type="string">
  base64 encoded string.
</ParamField>

<ParamField path="entityType" type="string">
  Entity type. Allowed: "product", "order", "delivery", "bom".
</ParamField>

<ParamField path="options" type="null | object">
  Apply specified [Import Options](#import-options-properties).
</ParamField>

### Return Value

The internal import id.

### Example Request

```json title="Request" theme={null}
{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "method" : "call",
    "params" : [
        "be1c13ed4e03f0ed7f1e4053dfff9658",
        "import.create",
        [
            "base64 encoded data",
            "order",
            {
                "handle_duplicates" : "drop",
                "send_email_on_complete" : 1,
                "email" : "email@example.com",
                "hold_orders" : "hold"
            }
        ]
    ]
}
```

### Example Response

```json title="Response" theme={null}
{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "error" : null,
    "result" : 7
}
```

### Error Codes

| code | message                                                                 |
| ---- | ----------------------------------------------------------------------- |
| 101  | Invalid filters given. Details in error message.                        |
| 103  | Invalid file type given.                                                |
| 104  | Invalid file data given.                                                |
| 105  | Internal error occurred.                                                |
| 106  | Internal error occurred while converting the import file to CSV format. |
| 107  | Internal error occurred while scheduling import job.                    |

## Entity Properties

### Import Options Properties

<Expandable title="Import Options Properties">
  <ParamField path="handle_duplicates" type="string">
    Handle duplicates. Allowed: "create", "drop", "break".
  </ParamField>

  <ParamField path="send_email_on_complete" type="integer">
    Flag whether send email on task complete.
  </ParamField>

  <ParamField path="email" type="string">
    Email address to send email after task complete. The email will only be sent if "send\_email\_on\_complete" flag is set to 1.
  </ParamField>

  <ParamField path="hold_orders" type="string">
    Order status. Allowed: "hold".
  </ParamField>
</Expandable>

### Import Properties

<Expandable title="Import Properties">
  <ParamField path="task_id" type="integer">
    The internal import ID.
  </ParamField>

  <ParamField path="status" type="string">
    Status. Allowed: "pending", "running", "complete".
  </ParamField>

  <ParamField path="progress" type="integer">
    Progress percent.
  </ParamField>

  <ParamField path="num_records" type="integer">
    Total number of records.
  </ParamField>

  <ParamField path="num_parse_success" type="integer">
    Number of successfully parsed records.
  </ParamField>

  <ParamField path="num_parse_failures" type="integer">
    Number of parse failures.
  </ParamField>

  <ParamField path="num_submit_success" type="integer">
    Number of successfully submitted records.
  </ParamField>

  <ParamField path="num_submit_failures" type="integer">
    Number of submit failures.
  </ParamField>
</Expandable>
