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

# Create a Settlement and generate a secure URL for file upload

> Generate a pre-signed URL to which you can upload your Mangopay-format settlement file

This endpoint returns a unique temporary pre-signed URL, `UploadUrl`, that you can use to upload your Mangopay-format settlement file (see [PUT Upload settlement file to secure URL](/api-reference/settlements/upload-settlement-file)).

### 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 POST ".../v3.0/{ClientId}/payins/intents/settlements" \
  -H "Authorization: Bearer token" \
  -H 'Content-Type: application/json' \
  -d {
    "FileName": "Example_File_Name.csv"
    }
  ```

  ```java Java theme={null}
  // null idempotencyKey in this example
  Settlement settlement = api.getSettlementApi().generateUploadUrl(settlementFileName, null); 
  ```

  ```c# .Net theme={null}
  var dto = new GenerateSettlementUploadUrlPostDTO { FileName = "settlement_sample.csv" };
  await Api.ApiSettlements.GenerateUploadUrl(dto);
  ```

  ```javascript NodeJS theme={null}
   api.Settlements.generateUploadUrl({FileName: "settlement_sample.csv"})
  ```

  ```php PHP theme={null}
   $settlement = new Settlement();
   $settlement->FileName = 'settlement_sample.csv';
   result = $this->_api->Settlements->GenerateUploadUrl($settlement);
  ```

  ```py Python theme={null}
  settlement = Settlement(file_name='settlement_sample.csv')
  created = SettlementTestLive._settlement = Settlement(**settlement.generate_upload_url())
  ```

  ```ruby Ruby theme={null}
  MangoPay::Settlement.generate_upload_url({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_13%3A25_019b2756-c2f8-78a6-9a8f-1a0d354cef20.csv?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEJ7%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCWV1LXdlc3QtMSJIMEYCIQC49GJoqW%2FixnIsaeFKCrvI4Yx9aTN7MfMn%2BBBa3YlgAgIhAPsckOjS8Q6EEILEt1PqjB35U2Ai80iglXzmhhp4M2xoKuUDCGYQAhoMODQ4OTQzNDkyMDQyIgx3igwjnJYW%2FrLuJYEqwgM95qmUSmbtZm1ND0ekhHDgLzmhSDVKzTT98Umx3FthNsHtC9ok2RHKEeqjvuB2tvuBviNmmZxmyfGv7W5YOdobkrPZLmxzlhUuOLO4W0mdQnOBUPzbt0bSGNl9KUHEFoThFwRJKXKcKjNU1BPF9jUUoIdBMnjFqZi2f1GygR9Dim9WSSFRm0XKVaOv37gptMUYfkH1GvD07yESbB%2Fsc9iGZwje98hhKYeL4xyl7qYtYD%2Br1S%2FXGGBpbtziDs95FoI8m%2BZ2FDjVveHPVv8%2FcfkrrRrw3MQ0cCTHX1weSXb%2FqrTEhfEA1ngrcb9G1N%2Fi%2FmyEmjMnlSK%2FCLplZplDeisKshcpClKA7Ry2nMxxTQ8qLImWAzxVI580DZKIi%2BNgvwpB5LnfWzJbKyhfTv8KbOPtRfPbMTxZi%2FUtzbfVc58dfPgEf0NLsIaDNiWkTkzgO4Tv4mffZrek2kTA6cwKcWlwTVnD2%2BDXFT8rkniOe2Y%2BnTxsY4mHlsuNSvTYkfFSqEXtrlPtXnVR6WV%2BSYcUzPLI444dsoUHHyd9CQ62vRDYIwO0UBDTVIq5JG8QdjMbhmALugijbAy6F%2FpINrlZlP8FFeEwlbeFygY6pAFg5Ufu5Ioip3HMq9sfvv0iXxhhx05EF43fiiFiizJMDW5kwMHfj1ko24K3C9J1dtqBqMgNuSWWNYPDAhAHbr0PeArUAE1sL5u6BFz3wkeY1IErGJ0gTzmlwj58j%2FrJvkajyXECzUnt%2BmXkIUBYVl0sEVLYku8q9Ztrrc70vXeu%2B4w4ieqjbEz1ZIeEKA8nRerscuFC1aagvyUD4%2F9Y9We%2FST9rfg%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20251216T132556Z&X-Amz-SignedHeaders=content-type%3Bhost&X-Amz-Expires=900&X-Amz-Credential=ASIA4LKHZVPFAEUA2EB4%2F20251216%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Signature=b460c40ef9f93fdb58adf9d8510707b47c97065e68c2e56bac60f4e0bf50ee3f",
      "SettlementId": "int_stlmnt_019b2756-c2f8-78a6-9a8f-1a0d354cef20"
  }
  ```
</ResponseExample>
