# Import

## Show Import

<mark style="color:blue;">`GET`</mark> `https://app.clubcollect.com/api/v2/imports/:id`

Fetch an Import’s details.

#### Path Parameters

| Name                                 | Type   | Description                         |
| ------------------------------------ | ------ | ----------------------------------- |
| id<mark style="color:red;">\*</mark> | string | Import ID, supplied by ClubCollect. |

#### Query Parameters

| Name    | Type   | Description                  |
| ------- | ------ | ---------------------------- |
| api:key | string | Partner API Key (Deprecated) |

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| Authorization<mark style="color:red;">\*</mark> | string | ApiKey \<api\_key> |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "import_id": "a1f3216863ba5d5424dcbace46ab37be98d70c92",
  "title": "Membership fees 2016/02",
  "transmitted": true|false,
  "transmitted_at": "2017-05-16T08:57:02+00:00",
  "prepaid_amount_cents": 123,
  "prepaid_amount_currency": "EUR|GBP|CHF",
  "settled_amount_cents": 456,
  "settled_amount_currency": "EUR|GBP|CHF",
  "expected_invoices_count": 3,
  "invoice_ids": [
    "47417520982b90764d0067d529691934e6ec3a42",
    "c0009400834121ded4cdd5a623da52f12c737262",
    "43cf319011497b1b40d81e341a652b04866a2d0b"
  ]
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
    "errors": "invalid_import_id"
}
```

{% endtab %}
{% endtabs %}

## Create Import

<mark style="color:green;">`POST`</mark> `https://app.clubcollect.com/api/v2/imports`

Create a new, empty Import.

#### Query Parameters

| Name    | Type   | Description                  |
| ------- | ------ | ---------------------------- |
| api:key | string | Partner API Key (Deprecated) |

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| Authorization<mark style="color:red;">\*</mark> | string | ApiKey \<api\_key> |

#### Request Body

| Name                                         | Type   | Description                                                                                                                                                              |
| -------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| title                                        | string |                                                                                                                                                                          |
| company:id<mark style="color:red;">\*</mark> | string | Company to which the Import should belong.                                                                                                                               |
| expected\_invoices\_count                    | string | Number of invoices expected to be added to this import. If provided the Import cannot be transmitted from the ClubCollect User Interface until all invoices are created. |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "import_id": "a1f3216863ba5d5424dcbace46ab37be98d70c92",
  "title": "Membership fees 2016/02",
  "transmitted": false,
  "transmitted_at": null,
  "prepaid_amount_cents": 0,
  "prepaid_amount_currency": "EUR",
  "settled_amount_cents": 0,
  "settled_amount_currency": "EUR",
  "expected_invoices_count": 0,
  "invoice_ids": [
  ]
}
```

{% endtab %}

{% tab title="422 " %}

```javascript
{
  "error": "invalid_company_id"
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
The following `/imports/:id/transmit` endpoint will be deprecated soon in favour of manually transmitting an Import via the ClubCollect User Interface. This gives treasurers the opportunity to configure settings correctly which is not possible via the API.
{% endhint %}

## Transmit Import

<mark style="color:orange;">`PUT`</mark> `https://app.clubcollect.com/api/v2/imports/:id/transmit`

Instruct ClubCollect to transmit the Import, initiating the invoice collection process.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | string | Import ID   |

#### Query Parameters

| Name    | Type   | Description                  |
| ------- | ------ | ---------------------------- |
| api:key | string | Partner API Key (Deprecated) |

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| Authorization<mark style="color:red;">\*</mark> | string | ApiKey \<api\_key> |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "import_id": "a1f3216863ba5d5424dcbace46ab37be98d70c92",
  "title": "Membership fees 2016/02",
  "transmitted": true,
  "transmitted_at": "2016-02-12T20:55:19Z",
  "prepaid_amount_cents": 0,
  "prepaid_amount_currency": "EUR",
  "settled_amount_cents": 0,
  "settled_amount_currency": "EUR",
  "expected_invoices_count": 0,
  "invoice_ids": [
  ]
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
  "error": "invalid_import_id"
}
```

{% endtab %}

{% tab title="422 " %}

```javascript
{
  "error": "import_already_transmitted"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Ensure you have finished creating all Invoices for this Import before calling this method. It is not possible to change or add more Invoices to an Import after the Import has been transmitted.
{% endhint %}

## Update Import

<mark style="color:orange;">`PUT`</mark> `https://app.clubcollect.com/api/v2/imports/:id`

Update an import.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | string | Import ID   |

#### Query Parameters

| Name    | Type   | Description                  |
| ------- | ------ | ---------------------------- |
| api:key | string | Partner API Key (Deprecated) |

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| Authorization<mark style="color:red;">\*</mark> | string | ApiKey \<api\_key> |

#### Request Body

| Name                      | Type   | Description                                                                                                                                                              |
| ------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| expected\_invoices\_count | string | Number of invoices expected to be added to this import. If provided the Import cannot be transmitted from the ClubCollect User Interface until all invoices are created. |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "import_id": "a1f3216863ba5d5424dcbace46ab37be98d70c92",
  "title": "Membership fees 2016/02",
  "transmitted": false,
  "transmitted_at": null,
  "prepaid_amount_cents": 0,
  "prepaid_amount_currency": "EUR",
  "settled_amount_cents": 0,
  "settled_amount_currency": "EUR",
  "expected_invoices_count": 0,
  "invoice_ids": [
  ]
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
  "error": "invalid_company_id"
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
  "error": "invalid_import_id"
}
```

{% endtab %}

{% tab title="422 " %}

```javascript
{
  "error": "import_already_transmitted"
}
```

{% endtab %}
{% endtabs %}

## Delete Import

<mark style="color:red;">`DELETE`</mark> `https://app.clubcollect.com/api/v2/imports/:id`

Deletes an import and all the invoices that have been created for the import.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | string | Import ID   |

#### Query Parameters

| Name    | Type   | Description                  |
| ------- | ------ | ---------------------------- |
| api:key | string | Partner API Key (Deprecated) |

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| Authorization<mark style="color:red;">\*</mark> | string | ApiKey \<api\_key> |

{% tabs %}
{% tab title="204 " %}

```
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
  "error": "invalid_import_id"
}
```

{% endtab %}

{% tab title="422 " %}

```javascript
{
  "error": "import_already_transmitted"
}
```

{% endtab %}
{% endtabs %}

## Fetch Company Imports

<mark style="color:blue;">`GET`</mark> `https://app.clubcollect.com/api/v2/companies/:id/imports`

Returns the list of import batches created by a company, paginated and sorted in ascending order, i.e. from oldest to newest.

#### Path Parameters

| Name                                 | Type   | Description                                                    |
| ------------------------------------ | ------ | -------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | string | ID of the company for which batches are requested.             |
| page\_number                         | string | Page number requested. If not specified, default to `1`.       |
| page\_size                           | string | Number of results per page. If not specified, default to `30`. |

#### Query Parameters

| Name    | Type   | Description                  |
| ------- | ------ | ---------------------------- |
| api:key | string | Partner API Key (Deprecated) |

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| Authorization<mark style="color:red;">\*</mark> | string | ApiKey \<api\_key> |

{% tabs %}
{% tab title="200 " %}

```javascript
"imports": [
  {
   "company_id": "477b4e18deb43367449d1ca74dc7f67b91e68ad3",
   "import_id": "78d366d133d6e26e32106b645f92c899f410897c",
   "title": "Membership fee 2019/1",
   "transmitted": "true",
   "transmitted_at": "2019-09-12T20:55:19Z"
  },
  {
   "company_id": "477b4e18deb43367449d1ca74dc7f67b91e68ad3",
   "import_id": "bffce68a7d109a9de3bfd3f3baacd06516492272",
   "title": "Membership fee 2019/2",
   "transmitted": "true",
   "transmitted_at": "2019-09-116T15:53:08Z"
  },
]
"page": {
  "page_number": 1,
  "total_pages": 1
}
```

{% endtab %}

{% tab title="404 " %}

```javascript
{
  "error": "not_found"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.clubcollect.com/api-documentation/import.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
