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

# Update a Settlement and generate a new upload URL

> Generate a new pre-signed URL to replace the file of an existing Settlement

You can use this endpoint to generate a new `UploadUrl` for an existing Settlement object (with `SettlementId`).

This is necessary if a file you uploaded previously is not parsed or reconciled successfully.

### Path parameters

<ParamField path="SettlementId" type="string" required>
  The unique identifier of the Settlement object.
</ParamField>

### Body parameters

<ParamField body="FileName" type="string" required>
  The name of your file, which can be anything you wish. The file extension must be `.csv`.
</ParamField>

### Responses

<AccordionGroup>
  <Accordion title="200 - OK" defaultOpen>
    <ResponseField name="UploadUrl" type="string">
      The unique temporary pre-signed URL to which to upload your CSV file. Use the full dynamic URL including the host, path, and all query parameters. The URL is already authenticated, so the call does not require an Authorization header. See [PUT Upload settlement file to secure URL](/api-reference/settlements/upload-settlement-file) for details
    </ResponseField>

    <ResponseField name="SettlementId" type="string">
      The unique identifier of the Settlement.
    </ResponseField>
  </Accordion>
</AccordionGroup>

***

<AccordionGroup>
  <Accordion title="400 - CSV format expected">
    ```json theme={null}
    {
        "Message": "One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.",
        "Id": "00612e42-27d0-4a19-94ba-69cc0aca91eb",
        "Date": 1765891663,
        "Type": "param_error",
        "Errors": {
            "FileName": "Invalid settlement file format. Expected CSV."
        }
    }
    ```
  </Accordion>
</AccordionGroup>

<RequestExample>
  ```bash cURL theme={null}
  curl -X PUT ".../v3.0/{ClientId}/payins/intents/settlements/{SettlementId}"" \
  -H "Authorization: Bearer token" \
  -H 'Content-Type: application/json' \
  -d {
    "FileName": "Example_File_Name.csv"
    }
  ```

  ```java Java theme={null}
  Settlement dto = new Settlement().setFileName("new_file_name_settlement.csv");
  dto.setId(existingSettlement.getSettlementId()); 
  Settlement newUploadUrl = api.getSettlementApi().generateNewUploadUrl(dto);
  ```

  ```c# .NET theme={null}
  var dto = new GenerateSettlementUploadUrlPutDTO { FileName = "settlement_sample_new.csv" };
  await Api.ApiSettlements.GenerateNewUploadUrl(dto, settlement.SettlementId);
  ```

  ```javascript NodeJS theme={null}
    api.Settlements.generateNewUploadUrl(settlement.SettlementId, {FileName: "settlement_sample_updated.csv"})
  ```

  ```php PHP theme={null}
  $dto = new Settlement();
  $dto->FileName = 'updated_settlement_sample.csv';
  $dto->Id = $settlement->SettlementId;
  $result = $this->_api->Settlements->GenerateNewUploadUrl($dto);
  ```

  ```py Python theme={null}
  dto = Settlement(id=settlement.settlement_id, file_name='updated_settlement_sample.csv')
  result = Settlement(**dto.generate_new_upload_url())
  ```

  ```ruby Ruby theme={null}
   MangoPay::Settlement.generate_new_upload_url(@settlement['SettlementId'], {FileName: 'settlement_sample.csv'})
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
      "UploadUrl": "https://s3.eu-west-1.amazonaws.com/private-files.sandbox.whenthen.co/mangopay/echo/settlement/2025-12-16/2025-12-16_15%3A48_019b27b9-51b6-7d9b-8a25-3db41e48cb16.csv?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEJ%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCWV1LXdlc3QtMSJHMEUCIQCVUBtIrNSPT6htcTYzzw9qtFvWg379Da2KvpTjMvoTLAIgW9Z7wboXMvdb0%2F%2BM9Wq7zQA7%2BRyU%2BkJbkjQX%2Fjs%2BYKoq5QMIaBACGgw4NDg5NDM0OTIwNDIiDMVZDy6EWkYO4ZOKqCrCA7twaEU50KVH4kjhUq6ZkcTQyHmde%2B3053ACU9eHnLg9e4qyZC0E%2FefWourxK5ijzbjOEsn9AxG0zivfxa4ID3QhLRQm8M3y67lANO6vntgoThjYGC6fNDJqBp0X%2FjUOdsHzR2lcWBkDXf3WEUzdJfjjtcyqYKP8%2BB02BKliNBskuB5VqBZ2mVVzxeIrfKsJK057xkaZbbTQH71WsZ2Vm7rgMCR6Kui0mC25MoqE2uY9XxBn%2FAMhjs2aCF6YiVSSXmndnYHWmV9WkprKTTHTCcEZYnYVY8F012EL74090CsWRBm1fcObzzphXah5Gs6uP7HmD6b8%2FBR%2FUmwCcCEVOvOFze5UTiz9W7l8F1R0iaCjeEjskJdAe8Nrr9Rhn1RwqwPagIBWfi%2FSqJ2NTjFNLlNkJZj8m9DWIP06TuZk6kEtChwxHsZrFattIpdV7n%2BwBWRuy9SW1dpa0zrn7fkiDiDGeZINXG%2Bd3ppIBcMZCxDZBwlXHKRG494JET6TUvzS7pamwFDiQnB5%2F7cTDHPg23FmLfr0sL1NZSmn%2BESG%2BkddADPMPMcqDJFq7i4BqBgBN6lkde%2F6Wc9MsJgnmxFCBogNCTD844XKBjqlAY3KNg8mnP8xf8CbnSE9mHdXjckmTscWMbCOCRJSLqyfFMLYO6McaCznpDuYDow9o%2FQ9ukefRxYRsEqAFgFKaLKlCD4gho1NOqcgU3RGDBQMYh0JGoCyLBfJCty3vC5EKNkMSJ5LjszpTP87TOtqDjDlDkm5zGDcAeDaxA063nFmtmcKjAzylV3bVmCjq%2F9PTKzhl4eRN94bDQUVKlDJ57gkH4iukA%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20251216T154802Z&X-Amz-SignedHeaders=content-type%3Bhost&X-Amz-Expires=900&X-Amz-Credential=ASIA4LKHZVPFCAF77JV4%2F20251216%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Signature=996e45921a28af0648191e5e290904ecae3119c7530f7ec3da067352dfdff6cc",
      "SettlementId": "int_stlmnt_019b2756-c2f8-78a6-9a8f-1a0d354cef20"
  }
  ```
</ResponseExample>
