# 续期选项

`GET /account/api/v1/renewals/options`

## 授权

`Authorization: Bearer YOUR_ARNPROXY_API_KEY`

`Accept: application/json`

所需权限: `read`

## 参数

| 名称 | 类型 | 必填 / 条件必填 | 默认值 | 说明 |
|---|---|---|---|---|
| `after_id` (query) | integer | 可选 | `0` | 使用上次响应的 next_after_id；按 ID 升序翻页，起始值 0。 |
| `limit` (query) | integer | 可选 | `25` | 1–100；默认 25。 |

## 请求示例

### curl

```curl
printf 'Authorization: Bearer %s\n' "$ARNPROXY_API_KEY" |
  curl --silent --show-error --header @- \
    --header 'Accept: application/json' \
    --connect-timeout 10 --max-time 30 \
    'https://www.arnproxy.com/account/api/v1/renewals/options'
```

### python

```python
import os, requests

headers = {"Authorization": "Bearer " + os.environ["ARNPROXY_API_KEY"]}
response = requests.get(
    "https://www.arnproxy.com/account/api/v1/renewals/options",
    headers=headers,
    timeout=(10, 30), allow_redirects=False
)
print(response.status_code, response.text)
# No automatic write retry.
```

### javascript

```javascript
const headers = { Authorization: `Bearer ${process.env.ARNPROXY_API_KEY}` };
const response = await fetch("https://www.arnproxy.com/account/api/v1/renewals/options", {
  method: 'GET', headers, redirect: 'error',
  signal: AbortSignal.timeout(30000)
});
console.log(response.status, await response.text());
// A write timeout is ambiguous; query its saved operation.
```

### php

```php
<?php
$headers = ['Accept: application/json',
    'Authorization: Bearer '.getenv('ARNPROXY_API_KEY')];
$ch = curl_init('https://www.arnproxy.com/account/api/v1/renewals/options');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_FOLLOWLOCATION => false,
    CURLOPT_SSL_VERIFYPEER => true, CURLOPT_SSL_VERIFYHOST => 2,
    CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_TIMEOUT => 30,
]);
$result = curl_exec($ch);
if ($result === false) {
    // Do not repeat a write; use the original operation key.
    throw new RuntimeException('Transport result unknown');
}
echo curl_getinfo($ch, CURLINFO_HTTP_CODE).PHP_EOL.$result;
curl_close($ch);
```

### go

```go
package main

import (
  "fmt"
  "io"
  "net/http"
  "os"
  "time"
)

func main() {
  client := &http.Client{Timeout: 30*time.Second,
    CheckRedirect: func(req *http.Request, via []*http.Request) error {
      return http.ErrUseLastResponse
    }}
  var body io.Reader
  req, err := http.NewRequest("GET", "https://www.arnproxy.com/account/api/v1/renewals/options", body)
  if err != nil { panic(err) }
  req.Header.Set("Authorization", "Bearer "+os.Getenv("ARNPROXY_API_KEY"))
  res, err := client.Do(req); if err != nil { panic(err) }
  defer res.Body.Close()
  data, err := io.ReadAll(res.Body); if err != nil { panic(err) }
  fmt.Println(res.StatusCode, string(data))
}
```

### csharp

```csharp
using System;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;

using var handler = new HttpClientHandler { AllowAutoRedirect = false };
using var client = new HttpClient(handler) { Timeout = TimeSpan.FromSeconds(30) };
using var request = new HttpRequestMessage(HttpMethod.Get,
    "https://www.arnproxy.com/account/api/v1/renewals/options");
request.Headers.Authorization = new AuthenticationHeaderValue(
    "Bearer", Environment.GetEnvironmentVariable("ARNPROXY_API_KEY"));
using var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
// Never automatically retry an ambiguous write.
```

### java

```java
import java.net.URI;
import java.net.http.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.*;

// Inside your application method:
var client = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder(URI.create("https://www.arnproxy.com/account/api/v1/renewals/options"))
    .header("Authorization", "Bearer " + System.getenv("ARNPROXY_API_KEY"))
    .header("Accept", "application/json")
    .GET()
    .build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
```

## 响应 · HTTP 200

```json
{
  "ok": true,
  "data": {
    "items": [
      {
        "id": 12345,
        "endpoint": "192.0.2.10:8080",
        "order_id": 10001,
        "product": {
          "id": 5,
          "name": "IPv4 Proxy"
        },
        "location": {
          "id": 10,
          "name": "Example country"
        },
        "last_service_date": "2030-02-01"
      }
    ],
    "next_after_id": null,
    "periods_by_location": [
      {
        "location_id": 10,
        "periods": [
          {
            "id": 101,
            "name": "7 days",
            "days": 7
          }
        ]
      }
    ],
    "currency": "TRY",
    "timezone": "Europe/Istanbul",
    "max_selected_proxies": 1000,
    "renewal_available": true
  },
  "meta": {
    "request_id": "000000000000000000000001",
    "phase": "public_v1",
    "source": "arnproxy_records"
  }
}
```

| 名称 | 类型 | 条件必填 | 说明 |
|---|---|---|---|
| `ok` | boolean | — | 成功标志；为 false 时请检查 error.code。 |
| `data` | object | — | 操作特定结果；示例均为演示用合成数据。 |
| `data.items` | array | — | 此页记录或格式化连接字符串；空列表也可能是有效结果。 |
| `data.items[]` | object | — | 此页记录或格式化连接字符串；空列表也可能是有效结果。 |
| `data.items[].id` | integer | — | 相关 ARNPROXY 记录 ID，请勿替换为上游内部 ID。 |
| `data.items[].endpoint` | string | — | 代理 IP/主机及可选端口，不含凭据；格式未经验证时可能为 null。 |
| `data.items[].order_id` | integer | — | 相关 ARNPROXY 记录 ID，请勿替换为上游内部 ID。 |
| `data.items[].product` | object | — | product 的操作特定值。请保留返回类型并查阅行为说明。 |
| `data.items[].product.id` | integer | — | 相关 ARNPROXY 记录 ID，请勿替换为上游内部 ID。 |
| `data.items[].product.name` | string | — | name 的操作特定值。请保留返回类型并查阅行为说明。 |
| `data.items[].location` | object | — | location 的操作特定值。请保留返回类型并查阅行为说明。 |
| `data.items[].location.id` | integer | — | 相关 ARNPROXY 记录 ID，请勿替换为上游内部 ID。 |
| `data.items[].location.name` | string | — | name 的操作特定值。请保留返回类型并查阅行为说明。 |
| `data.items[].last_service_date` | string | — | 最后服务日：当前、之前或报价预测日期。预测本身不会执行续期。 |
| `data.next_after_id` | integer|null | — | 下一页游标；为 null 时表示本结果无后续页。 |
| `data.periods_by_location` | array | — | periods by location 的操作特定值。请保留返回类型并查阅行为说明。 |
| `data.periods_by_location[]` | object | — | periods by location 的操作特定值。请保留返回类型并查阅行为说明。 |
| `data.periods_by_location[].location_id` | integer | — | 本地目录的位置或产品类型 ID。 |
| `data.periods_by_location[].periods` | array | — | periods 的操作特定值。请保留返回类型并查阅行为说明。 |
| `data.periods_by_location[].periods[]` | object | — | periods 的操作特定值。请保留返回类型并查阅行为说明。 |
| `data.periods_by_location[].periods[].id` | integer | — | 相关 ARNPROXY 记录 ID，请勿替换为上游内部 ID。 |
| `data.periods_by_location[].periods[].name` | string | — | name 的操作特定值。请保留返回类型并查阅行为说明。 |
| `data.periods_by_location[].periods[].days` | integer | — | 方案天数，与 GB 方案流量数量分开。 |
| `data.currency` | string | — | 账户交易币种：TRY 或 USD。 |
| `data.timezone` | string | — | 相关日期字段的时区；null 表示没有已验证时区。 |
| `data.max_selected_proxies` | integer | — | max selected proxies 的操作特定值。请保留返回类型并查阅行为说明。 |
| `data.renewal_available` | boolean | — | 根据响应条件/权限确定的可用性，不代表库存或上游可用性保证。 |
| `meta` | object | — | 请求关联与数据来源元信息。 |
| `meta.request_id` | string | — | 此 HTTP 请求的跟踪 ID，不是操作键或订单 ID。 |
| `meta.phase` | string | — | phase 的操作特定值。请保留返回类型并查阅行为说明。 |
| `meta.source` | string | — | 数据来源；本地记录与实时上游查询属于不同证据。 |

## 行为与重要说明

- 续期使用现有网站定价和余额流程。金额、天数和选择摘要必须来自同一 renewal_quote；此操作不会开启自动续期。

身份验证和参数校验可能在执行前拒绝请求。请查阅错误参考，联系支持时保留 request_id。切勿发送密钥或密码。

[错误与限制](https://docs.arnproxy.com/zh/api-v1/errors)
