> ## 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

> Import a list of cost-centers. Endpoint to use for bulk import of cost-centers.

<Tip>You may want to refer to the [dedicated guide](/api-reference/legacy/cleemy-invoices/guides/import-cost-centers).</Tip>


## OpenAPI

````yaml /openapi-specs/lucca-invoices.yaml post /cleemy-procurement/services/imports/costcenters
openapi: 3.1.0
info:
  title: Lucca.Invoices
  version: '1.0'
  description: |
    Welcome on the documentation for the Lucca Invoices API.
  contact:
    name: API Support
    url: https://support.lucca.fr
    email: contact@luccasoftware.com
  license:
    name: Unlicensed
    url: https://www.luccasoftware.com
servers:
  - url: https://{host}
    description: Your Lucca account URL.
    variables:
      host:
        default: example.ilucca.net
        description: >-
          The URL of your dedicated Lucca account: `{account}.{env}.{region}`.


          Account reflects your company name. Env indicates the environment.
          Region depends on your server location.


          **Please, use your test or sandbox environments (and not your
          production env.) for testing purposes.**


          Environments:

          - `ilucca`: production environment for customers.

          - `ilucca-test`: test environment for customers.

          - `ilucca-demo`: demo environment for prospects.


          Regions:

          - `.ch` for Swiss located accounts.

          - `.net` for the others.


          Regarding sandboxes, the pattern differs:
          `https://{account}-{sandboxName}.sandbox.{server}.luccasoftware.com`,
          where:

          - `{sandboxName}` is automatically generated upon creation.

          - `{server}` may be "eu1", "eu2" or "ch1".
security: []
tags:
  - name: Purchases
    description: Purchases.
  - name: Cost-Centers
    description: Cost-Centers.
  - name: Approval
    description: Approval.
  - name: VAT
    description: VAT Rates.
  - name: Booked-Documents
    description: Booked-Documents.
  - name: Suppliers
    description: Suppliers.
  - name: Natures
    description: Natures.
  - name: Invoices
    description: Invoices.
  - name: Inbox
    description: Inbox.
  - name: Documents
    description: Documents.
paths:
  /cleemy-procurement/services/imports/costcenters:
    parameters:
      - $ref: '#/components/parameters/Authorization'
    post:
      tags:
        - Cost-Centers
      summary: Import Cost-Centers
      description: >-
        Import a list of cost-centers. Endpoint to use for bulk import of
        cost-centers.
      operationId: import-cost-centers
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                mode:
                  $ref: '#/components/schemas/import-mode'
                items:
                  description: List of cost-centers to import.
                  type: array
                  items:
                    type: object
                    required:
                      - name
                      - code
                    properties:
                      name:
                        description: Name of the cost-center.
                        type: string
                      code:
                        description: Code of the cost-center.
                        type: string
                      ownerId:
                        description: >-
                          ID of the user who will be the owner of the
                          cost-center.
                        type: integer
                        format: int32
                      state:
                        $ref: '#/components/schemas/cost-center-state'
                        description: >-
                          State of the cost-center. Disabled: the cost-center is
                          disabled. Enabled: the cost-center is enabled.
                      establishmentIds:
                        description: >-
                          IDs of the establishments to which the cost-center
                          belongs.
                        type: array
                        items:
                          type: integer
                          format: int32
      responses:
        '200':
          description: Successful cost-centers import.
          content:
            application/json:
              schema:
                type: object
                properties:
                  mode:
                    $ref: '#/components/schemas/import-mode'
                  imported:
                    description: Number of items imported.
                    type: integer
                    format: int32
                    minimum: 0
                  failedValidation:
                    description: Number of items failed validation.
                    type: integer
                    format: int3é
                    minimum: 0
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        result:
                          $ref: '#/components/schemas/cost-center'
                        problem:
                          $ref: '#/components/schemas/problem'
components:
  parameters:
    Authorization:
      name: Authorization
      required: true
      description: 'API key. Value must be formatted like so: `lucca application={api_key}`.'
      in: header
      schema:
        type: string
  schemas:
    import-mode:
      title: Import Mode (enum)
      description: >-
        AllOrNothing: all items are imported or none. SkipInvalidItems: items
        are imported if valid, skipped if not.
      type: string
      enum:
        - AllOrNothing
        - SkipInvalidItems
    cost-center-state:
      title: Cost-Center State (enum)
      description: >-
        Disabled: the cost-center is disabled. Enabled: the cost-center is
        enabled.
      type: string
      enum:
        - Disabled
        - Enabled
      default: Disabled
    cost-center:
      title: cost-center
      description: Cost-center.
      type: object
      required:
        - name
        - code
      properties:
        id:
          type: integer
          format: int32
          readOnly: true
        name:
          type: string
        code:
          type: string
        ownerId:
          description: ID of the user who will be the owner of the cost-center.
          type: integer
          format: int32
          writeOnly: true
        owner:
          allOf:
            - $ref: '#/components/schemas/user-reference'
            - readOnly: true
              description: '**Read-only.** Owner of the cost-center.'
        state:
          $ref: '#/components/schemas/cost-center-state'
        establishmentIds:
          description: >-
            **Write-only.** IDs of the establishments to which the cost-center
            belongs."
          writeOnly: true
          type: array
          items:
            type: integer
            format: int32
        establishments:
          description: '**Read-only.** Establishments to which the cost-center belongs.'
          readOnly: true
          type: array
          items:
            $ref: '#/components/schemas/establishment-reference'
    problem:
      title: Problem-detail
      type: object
      properties:
        type:
          type:
            - string
            - 'null'
        title:
          type:
            - string
            - 'null'
        status:
          type:
            - integer
            - 'null'
        detail:
          type:
            - string
            - 'null'
        instance:
          type:
            - string
            - 'null'
    user-reference:
      title: Reference to a user
      description: Reference to a user.
      type: object
      required: []
      properties:
        id:
          type: integer
          format: int32
        href:
          type: string
          format: uri
          readOnly: true
        name:
          type: string
          readOnly: true
        firstName:
          type: string
          readOnly: true
        lastName:
          type: string
          readOnly: true
        pictureHref:
          description: '**Read-only.** URL to this user picture image file.'
          type:
            - string
            - 'null'
          format: uri
          readOnly: true
    establishment-reference:
      title: Reference to an establishment
      description: Reference to an establishment.
      type: object
      required: []
      properties:
        id:
          type: integer
          format: int32
        name:
          type: string
          readOnly: true
        href:
          type: string
          format: uri
          readOnly: true

````