# Error during API call to upload new csv files for Delimited File sources

**URL:** <https://developer.sailpoint.com/discuss/t/error-during-api-call-to-upload-new-csv-files-for-delimited-file-sources/8362>\
**Category:** SHF Discussion and Questions\
**Tags:** identity-security-cloud, flat-file-connector, sources, aggregation\
**Created:** [February 20, 2023, 5:00pm UTC](https://developer.sailpoint.com/discuss/t/error-during-api-call-to-upload-new-csv-files-for-delimited-file-sources/8362 "2023-02-20T17:00:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexandre\_mazars](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/alexandre_mazars/32/2860_2.png) [@alexandre\_mazars](https://developer.sailpoint.com/discuss/u/alexandre_mazars)\
**Post date:** [February 20, 2023, 5:00pm UTC](https://developer.sailpoint.com/discuss/t/error-during-api-call-to-upload-new-csv-files-for-delimited-file-sources/8362/1 "2023-02-20T17:00:56Z")

</div>

Hello Collin,

Thanks a lot, seems it’s working correctly !  
Do you know if it is possible to disable the account deletion threshold through this API call ?

Regards

---

<div class="post-metadata">

**Author:** ![colin\_mckibben](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/colin_mckibben/32/37182_2.png) [@colin\_mckibben](https://developer.sailpoint.com/discuss/u/colin_mckibben)\
**Post date:** [February 20, 2023, 6:16pm UTC](https://developer.sailpoint.com/discuss/t/error-during-api-call-to-upload-new-csv-files-for-delimited-file-sources/8362/2 "2023-02-20T18:16:35Z")

</div>

Try this:

```python
import requests

url = "https://{tenant}.api.identitynow.com/cc/api/source/loadAccounts/{sourceId}"

payload={}
files=[
  ('file',('employees.csv',open('/path/to/employees.csv','rb'),'text/csv'))
]
headers = {
  'Authorization': 'Bearer {token}'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)

```

---

<div class="post-metadata">

**Author:** ![alexandre\_mazars](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/alexandre_mazars/32/2860_2.png) [@alexandre\_mazars](https://developer.sailpoint.com/discuss/u/alexandre_mazars)\
**Post date:** [April 13, 2023, 8:50am UTC](https://developer.sailpoint.com/discuss/t/error-during-api-call-to-upload-new-csv-files-for-delimited-file-sources/8362/3 "2023-04-13T08:50:10Z")

</div>

Hello,

This solution was working correctly but since yesterday, I’m not able to make it work. I am getting the following error :

`{'msg_template': 'status code: 500, reason phrase: Internal Server Error', 'slpt_error_code': 'SLPT-1009', 'formatted_msg': 'status code: 500, reason phrase: Internal Server Error', 'exception_id': '18779CCE567', 'error_code': 1009, 'exception_class': 'groovyx.net.http.HttpResponseException', 'exception_detail': {'file': 'RESTClient.java', 'method': 'defaultFailureHandler', 'line_number': 240, 'class': 'groovyx.net.http.RESTClient'}, 'http_response_code': 500, 'timestamp': '2023-04-13 08:48:03.943', 'exception_message': 'status code: 500, reason phrase: Internal Server Error'}`

Regarding my function, it is :

```plaintext
print("Aggregation des comptes dans IdentityNow")
    identifiant = get_source_id_by_name(tenant_id, token, "Source Name")
    url = "https://" + tenant_id + ".identitynow.com/cc/api/source/loadAccounts/" + identifiant
    payload={}
    files=[
      ('file',('accounts.csv',open(account_file,'rb'),'text/csv'))
    ]
    headers = {
      'Authorization': 'Bearer ' + token
    }
    print(url)
    print(files)
    r = requests.request("POST", url, headers=headers, data=payload, files=files, verify=False)
    return json.loads(r.text)

```

Do you have any idea of why I’m getting this error ?

---

<div class="post-metadata">

**Author:** ![colin\_mckibben](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/colin_mckibben/32/37182_2.png) [@colin\_mckibben](https://developer.sailpoint.com/discuss/u/colin_mckibben)\
**Post date:** [April 13, 2023, 1:44pm UTC](https://developer.sailpoint.com/discuss/t/error-during-api-call-to-upload-new-csv-files-for-delimited-file-sources/8362/4 "2023-04-13T13:44:41Z")

</div>

Has anything about the source or the file you are uploading changed? Are you attempting to delete more accounts than the threshold allows?

---

<div class="post-metadata">

**Author:** ![alexandre\_mazars](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/alexandre_mazars/32/2860_2.png) [@alexandre\_mazars](https://developer.sailpoint.com/discuss/u/alexandre_mazars)\
**Post date:** [May 4, 2023, 2:32pm UTC](https://developer.sailpoint.com/discuss/t/error-during-api-call-to-upload-new-csv-files-for-delimited-file-sources/8362/5 "2023-05-04T14:32:53Z")

</div>

Hello,

Finally it was an issue on the rights of our service account.

So solution is working !

Regards

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [July 19, 2023, 2:24pm UTC](https://developer.sailpoint.com/discuss/t/error-during-api-call-to-upload-new-csv-files-for-delimited-file-sources/8362/6 "2023-07-19T14:24:22Z")

</div>


