# Generate the URL for downloading the billing data file - GetBillDataFileUrl

## Overview

Generate the URL for downloading the billing data file, which includes three types of files, 1. Paid overview bill (supports CSV and PDF, PDF is supported from March 2023); 2. Unpaid overview file (supports CSV, only the current month's billing period can be viewed); 3. Bill detail file (supports CSV). Note: File generation is delayed, if the return value is IsValid='no', the user needs to initiate a retry.






## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `GetBillDataFileUrl`.                      | **Yes** |
| **PublicKey**  | string  | The user's public key can be obtained from [Console](https://console.genesissai.com/uaccount/api_manage)                                             | **Yes** |
| **Signature**  | string  | User signature generated based on public key and API command, see [Signature Algorithm](/docs/api/summary/signature.md)  | **Yes** |

### Request Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **BillType** | int | Bill type, enumeration values: <br /><br /> > 0: Bill Overview Report; <br /><br /> > 1: Bill Detail Report |**Yes**|
| **BillingCycle** | string | Billing Period: A string in the format of YYYY-MM, for example, '2021-08'. |**Yes**|
| **BillPeriod** | int | Billing Period: Timestamp format, deprecated, please use BillingCycle. |No|
| **PaidType** | int | Bill Payment Status, (To get the bill details report, this parameter is not required), Enumerated values: <br /><br /> > 0: 0 Pending payment overview bill (only supports the current month's billing period); <br /><br /> > 1: Paid bill overview |No|
| **RequireVersion** | string | Bill language version, enumeration values: <br /><br /> > '': Default Chinese; <br /><br /> > 'EN': English version |No|
| **Version** | string | File version, fixed value "v1". |No|
| **Format** | string | File format, enumeration values: <br /><br /> > "csv": csv format; <br /><br /> > "pdf": pdf format (Total paid overview file supports PDF from March 2023 onwards) |No|

### Response Field

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **RetCode** | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. |**Yes**|
| **Action** | string | Operation command name. |**Yes**|
| **Message** | string | Returns an error message, providing detailed description when `RetCode` is non-zero. |No|
| **FileUrl** | string | Transaction bill file download URL |No|
| **IsValid** | string | Is there a corresponding data file? (If this parameter returns 'no', it means the file is being generated and the user needs to initiate a retry to obtain it. |No|




## Example

### Request Example
    
```
https://api.genesissai.com/?Action=GetBillDataFileUrl
&BillingCycle="2021-12"
&BillType=1
&PaidType=1
&RequireVersion="EN"
&Version="v1"
&Format=fzBtbbkp
&BillPeriod=6
&BillPeriod=7
```

### Response Example
    
```json
{
  "Action": "GetBillDataFileUrlResponse",
  "FileUrl": "https://channel-1.cn-bj.ufileos.com/order-detail-1-2021-12-en.v1.csv?UCloudPublicKey=TOKEN_6ecddc1d-96c3-49a0-bfa6-ef1621f075fa\u0026Expires=1640163358\u0026Signature=0IfhSgJl2SrYbMl6bAnNW7kmhYw=",
  "IsValid": "yes",
  "RetCode": 0
}
```





