# Import Cost Accounts

Import Cost Account APIs provide capabilities to the users to add multiple cost accounts in batch. This feature makes the customer process efficient by enabling them to create cost accounts by adding relevant details in csv file format and upload.

1. **Create Cost Account Import Job**: This API provides user a unique jobID and url which can be used to upload cost accounts by adding details in csv format. Sample Cost Account csv template is provided below. Please unzip and use the csv file to add cost account details.


1. **Upload csv file to the uploadUrl generated from previous step response**: Below curl to be used for uploading the cost account csv file. Upon successful 200 response code will be returned.

```bash
curl --location --request PUT '<uploadUrl>' \
--header 'Content-Type: text/csv' \
--data '@/C:/Users/sample-cost-accounts-import.csv'
```
2. **Process Cost Account job**: After importing the cost accounts, the user initiates the processing of the batch. This operation triggers the system to generate cost accounts.
3. **Get Status of Cost Account job**: The user can check the status of the batch after processing. This operation retrieves the current status of the batch, indicating whether the cost accounts have been generated successfully, any errors encountered during processing. It also returns a url containig csv file with error details.


```mermaid
        flowchart TD
        A[Create Cost Account Import Job] -->|upload file containing <br> cost account data in a specific format <br><br>| B[Process Import Cost Account Job]
        B --> C[Get Status of an Import Cost Account Job] 
        C --> D{Check Status}
        D --> |success|E[Cost Accounts generated]
        D --> |error|F[Reported in Status]
```