# BuyUFilePkg - BuyUFilePkg

## Overview

BuyUFilePkg






## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `BuyUFilePkg`.                      | **Yes** |
| **PublicKey**  | string  | The user's public key can be obtained from [Console](https://console.sigcalcloud.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 |
|:---|:---|:---|:---|
| **Region** | string | Region. See [List of Regions and Availability Zones](/docs/api/summary/regionlist) |**Yes**|
| **Zone** | string | Availability Zones. See [List of Availability Zones](/docs/api/summary/regionlist) |No|
| **ProjectId** | string | Project ID. If not filled in, the default project is used, sub-accounts must be filled in. Please refer to the [GetProjectList interface](/docs/api/summary/get_project_list). |No|
| **PkgName** | string | Resource package name |**Yes**|
| **PkgType** | int | Resource package type. 0: Standard storage package, 1: Busy hour traffic package, 2: Off-peak traffic package |**Yes**|
| **Amount** | int | Purchase Quantity |**Yes**|
| **AmountUnit** | string | Units of quantity, such as GB, TB, etc. |**Yes**|
| **Duration** | int | Purchase duration |**Yes**|
| **DurationUnit** | string |  Units of time, such as Month, Year, etc. |**Yes**|

### 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|
| **ResourceId** | string | Purchase successful, resource package ID returned. |**Yes**|




## Example

### Request Example
    
```
https://api.sigcalcloud.com/?Action=BuyUFilePkg
&Region=cn-zj
&Zone=cn-zj-01
&ProjectId=rREmamOK
&PkgType=4
&Amount=6
&AmountUnit=MsWaKxSE
&Duration=4
&DurationUnit=mpKaIfHW
&PkgName=RGlqTlci
```

### Response Example
    
```json
{
  "Action": "BuyUFilePkgResponse",
  "ResourceId": "tAUKBskD",
  "RetCode": 0
}
```





