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

# Import cost-centers

> Use our API dedicated to import cost centers within Lucca Invoices

## Description

If you want to create several cost centers through our API, you can use an endpoint made for it. It natively manages potential errors you might meet while making the import.
Moreover, it allows you to choose between two solutions if an error is detected :

* skip the process and import no data
* import only the data correct

## API call

<CodeGroup>
  ```http Import a list of cost-centers theme={null}
  POST /cleemy-procurement/services/imports/costcenters HTTPS/2
  Host: example.ilucca.net
  Authorization: lucca application={API_KEY}
  Content-Type: application/json

  {
      "mode": "AllOrNothing",
      "items": [
          {
              "name": "string", 
              "code": "string",
              "ownerId": 0, // userId Lucca
              "state": "Enabled", // possible values : enabled or disabled. Or enabled by default.
              "establishmentIds": [
                  0 // establishmentId Lucca
              ]
          }
      ]
  }
  ```
</CodeGroup>

<Note>Success is indicated by a `200` response status code. If so, the response contains a `purchaseId` which is the identifier of the created Purchase object.</Note>

<Accordion title="Precisions about the mode">
  Two modes are possible :

  * `AllOrNothing` : if an error is detected, skip the whole process and import no data.
  * `SkipInvalidItems` : if an error is detected, skip only the invalid items and import the valid ones.
</Accordion>
