# 연결 목록 내보내기

`POST /account/api/v1/residential/export`

## 권한 인증

`Authorization: Bearer YOUR_ARNPROXY_API_KEY`

`Accept: application/json`

필요한 권한: `read + optional credentials`

`Content-Type: application/json`

## 매개변수

| 이름 | 유형 | 필수 / 조건부 | 기본값 | 설명 |
|---|---|---|---|---|
| `list_id` (body) | integer | 필수 | — | 본인 ARNPROXY 연결 목록 기록 ID이며 공급자 목록 ID가 아닙니다. |
| `format` (body) | string | 선택 | `"host_port"` | host_port \| host_port_user_pass \| user_pass_host_port \| uri. 인증 정보는 credentials 필요. csv \| custom도 지원. |
| `protocol` (body) | string | 선택 | `"http"` | http 또는 socks5. uri 출력의 접두사만 제어합니다. |
| `offset` (body) | integer | 선택 | `0` | 0~9999, 포트 수보다 작아야 합니다. |
| `limit` (body) | integer | 선택 | `100` | 1~1000, 기본 100. |
| `columns` (body) | string[] | 조건부 | — | CSV 전용: id, endpoint, ip, port, login, password. 기본 ["id","endpoint"]. login/password에는 credentials 권한이 필요합니다. |
| `template` (body) | string | 조건부 | — | custom에서 필수, 최대 200자. %endpoint%, %ip%, %port%, %id%, %login%, %username%, %password%, %login_url%, %password_url% 사용 가능. 제어 문자와 알 수 없는 자리표시자는 거부됩니다. |

## 요청 본문

YOUR_/FROM_을 해당 카탈로그, 견적 또는 범위의 값으로 바꾸세요. 예제의 동의 값은 false입니다. 실제 작업에 동의할 때만 승인하세요.

```json
{
  "list_id": "YOUR_LIST_ID",
  "format": "host_port",
  "offset": 0,
  "limit": 10
}
```

## 추가 사용 예제

ID와 가격은 예시입니다. 카탈로그와 동일 견적의 실제 값을 사용하고 JSON ID 및 expected_total_minor는 숫자로 보내세요. 예제의 terms=false는 안전을 위한 값입니다. 실제 유료 작업에 대한 고객의 명시적 동의 후에만 terms=true를 보내세요.

### CSV 내보내기

CSV 열은 id, endpoint, ip, port, login, password 중에서 선택합니다. 사용자 지정 형식은 문서화된 %...% 토큰만 허용하며 코드를 실행하지 않습니다. 접속 정보가 포함되면 credentials 권한이 필요합니다. 내용은 JSON으로 반환되며 파일 저장은 애플리케이션이 수행합니다.

```json
{
  "list_id": 10001,
  "format": "csv",
  "columns": [
    "id",
    "endpoint"
  ],
  "protocol": "http",
  "offset": 0,
  "limit": 10
}
```

### 사용자 지정 연결 형식

CSV 열은 id, endpoint, ip, port, login, password 중에서 선택합니다. 사용자 지정 형식은 문서화된 %...% 토큰만 허용하며 코드를 실행하지 않습니다. 접속 정보가 포함되면 credentials 권한이 필요합니다. 내용은 JSON으로 반환되며 파일 저장은 애플리케이션이 수행합니다.

```json
{
  "list_id": 10001,
  "format": "custom",
  "template": "http://%login_url%:%password_url%@%endpoint%",
  "protocol": "http",
  "offset": 0,
  "limit": 10
}
```

## 요청 예제

### 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 \
    --request POST --header 'Content-Type: application/json' \
    --data-binary @request.json \
    'https://www.arnproxy.com/account/api/v1/residential/export'
```

### python

```python
import os, requests

headers = {"Authorization": "Bearer " + os.environ["ARNPROXY_API_KEY"]}
import json
with open("request.json", encoding="utf-8") as f:
    payload = json.load(f)
response = requests.post(
    "https://www.arnproxy.com/account/api/v1/residential/export",
    headers=headers, json=payload,
    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 { readFile } = await import('node:fs/promises');
headers['Content-Type'] = 'application/json';
const body = await readFile('request.json', 'utf8');
const response = await fetch("https://www.arnproxy.com/account/api/v1/residential/export", {
  method: 'POST', headers, redirect: 'error',
  signal: AbortSignal.timeout(30000), body
});
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')];
$headers[] = 'Content-Type: application/json';
$ch = curl_init('https://www.arnproxy.com/account/api/v1/residential/export');
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,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => file_get_contents('request.json'),
]);
$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
  file, err := os.Open("request.json"); if err != nil { panic(err) }
  defer file.Close(); body = file
  req, err := http.NewRequest("POST", "https://www.arnproxy.com/account/api/v1/residential/export", body)
  if err != nil { panic(err) }
  req.Header.Set("Authorization", "Bearer "+os.Getenv("ARNPROXY_API_KEY"))
  req.Header.Set("Content-Type", "application/json")
  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.Post,
    "https://www.arnproxy.com/account/api/v1/residential/export");
request.Headers.Authorization = new AuthenticationHeaderValue(
    "Bearer", Environment.GetEnvironmentVariable("ARNPROXY_API_KEY"));
request.Content = new StringContent(
    await File.ReadAllTextAsync("request.json"), Encoding.UTF8, "application/json");
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/residential/export"))
    .header("Authorization", "Bearer " + System.getenv("ARNPROXY_API_KEY"))
    .header("Accept", "application/json")
    .header("Content-Type", "application/json")
    .POST(HttpRequest.BodyPublishers.ofString(
        Files.readString(Path.of("request.json"), StandardCharsets.UTF_8)))
    .build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
```

## 응답 · HTTP 200

```json
{
  "ok": true,
  "data": {
    "list_id": 30001,
    "package_id": 20001,
    "authentication": "login_password",
    "format": "host_port",
    "protocol": null,
    "items": [
      "res.arnproxy.com:10000"
    ],
    "count": 1,
    "next_offset": 1,
    "credentials_included": false,
    "snapshot": {
      "source": "arnproxy_records",
      "observed_at": "2030-01-01T12:00:00+00:00",
      "fresh": true,
      "max_age_seconds": 3600,
      "reason": null
    },
    "source": "arnproxy_records",
    "provider_requests": 0,
    "proxy_connections_tested": false,
    "session_targeting_applied": false
  },
  "meta": {
    "request_id": "000000000000000000000001",
    "phase": "public_v1",
    "source": "arnproxy_records"
  }
}
```

| 이름 | 유형 | 조건부 | 설명 |
|---|---|---|---|
| `ok` | boolean | — | 성공 여부. false이면 error.code를 확인하세요. |
| `data` | object | — | 작업별 결과이며 예제는 설명용 합성 데이터입니다. |
| `data.list_id` | integer | — | 관련 ARNPROXY 기록 ID. 공급자 내부 ID 대신 사용하세요. |
| `data.package_id` | integer | — | 관련 ARNPROXY 기록 ID. 공급자 내부 ID 대신 사용하세요. |
| `data.authentication` | string | — | 연결 목록 인증 방식: login_password 또는 ip_auth. |
| `data.format` | string | — | format의 작업별 값입니다. 반환된 유형을 유지하고 동작 설명을 확인하세요. |
| `data.protocol` | string|null | — | protocol의 작업별 값입니다. 반환된 유형을 유지하고 동작 설명을 확인하세요. |
| `data.items` | array | — | 현재 페이지 기록 또는 형식화된 연결 문자열. 빈 목록도 유효할 수 있습니다. |
| `data.items[]` | string | — | 현재 페이지 기록 또는 형식화된 연결 문자열. 빈 목록도 유효할 수 있습니다. |
| `data.count` | integer | — | 결과에 표시되는 기록 수 또는 생성된 연결 수. |
| `data.next_offset` | integer | — | 연결 출력의 다음 오프셋이며 완료 시 null입니다. |
| `data.credentials_included` | boolean | — | 결과/키가 민감한 인증 정보를 포함하거나 허용하는지 여부. |
| `data.snapshot` | object | — | 패키지 관측의 출처/시간/최신성. 오래된 스냅샷은 관리 권한을 주지 않습니다. |
| `data.snapshot.source` | string | — | 데이터 출처. 로컬 기록과 실시간 공급자 조회는 서로 다른 근거입니다. |
| `data.snapshot.observed_at` | string | — | API가 반환하는 형식의 타임스탬프. 예제 날짜는 합성값입니다. |
| `data.snapshot.fresh` | boolean | — | 관측이 최신성 허용 범위에 들어가는지 여부. |
| `data.snapshot.max_age_seconds` | integer | — | 최신 관측으로 인정하는 최대 경과 초. |
| `data.snapshot.reason` | string|null | — | 고정 사유 코드 또는 null이며 원본 공급자 오류 텍스트가 아닙니다. |
| `data.source` | string | — | 데이터 출처. 로컬 기록과 실시간 공급자 조회는 서로 다른 근거입니다. |
| `data.provider_requests` | integer | — | provider requests의 작업별 값입니다. 반환된 유형을 유지하고 동작 설명을 확인하세요. |
| `data.proxy_connections_tested` | boolean | — | proxy connections tested의 작업별 값입니다. 반환된 유형을 유지하고 동작 설명을 확인하세요. |
| `data.session_targeting_applied` | boolean | — | session targeting applied의 작업별 값입니다. 반환된 유형을 유지하고 동작 설명을 확인하세요. |
| `meta` | object | — | 요청 추적 및 데이터 출처 메타데이터. |
| `meta.request_id` | string | — | 이 HTTP 요청의 추적 ID이며 작업 키나 주문 ID가 아닙니다. |
| `meta.phase` | string | — | phase의 작업별 값입니다. 반환된 유형을 유지하고 동작 설명을 확인하세요. |
| `meta.source` | string | — | 데이터 출처. 로컬 기록과 실시간 공급자 조회는 서로 다른 근거입니다. |

## 동작 및 주요 참고 사항

- 패키지와 목록 ID는 ARNPROXY 기록 ID이며 공급자 키가 아닙니다. 오래된 스냅샷은 접근을 허용하지 않습니다. 필요 시 residential_package_refresh를 사용하세요.
- 인증 정보가 포함된 출력에는 credentials 권한이 필요합니다. 연결 문자열, 비밀번호, Authorization 헤더를 로그에 남기거나 지원팀에 보내지 마세요.

인증 및 검증 단계에서 실행 전에 요청이 거부될 수 있습니다. 오류 문서를 확인하고 지원 문의용 request_id를 보관하세요. 키나 비밀번호를 보내지 마세요.

[오류 및 제한](https://docs.arnproxy.com/ko/api-v1/errors)
