Skip to main content

Adding New Proxies (Bulk)

Description: This method processes an array of proxy data and creates all specified proxies. Errors during creation of individual proxies are ignored.

Request parameters:

ParameterTypeFormatDefaultDescription
workspaceIdintegerint64-1Workspace identifier. -1 means the default workspace.
folderIdstringuuid(empty)Optional folder ID to associate with all created proxies.

Request body:

FieldTypeFormatRequiredDescription
bodyarray[ProxyData]schema(optional)Array of proxy data containing URI, name, and optional IP change URL for each proxy.

Example request:

POST
CURL:

curl 'http://localhost:8160/v1/proxies/create_bulk?workspaceId=-1&folderId=123e4567-e89b-12d3-a456-426614174000' \
--request POST \
--header 'Api-Token: YOUR_SECRET_TOKEN' \

--header 'Content-Type: application/json' \
--data '[
{
"proxyUri": "http://login:pass@127.0.0.1:8080",
"name": "Sample Name",
"ipChangeUrl": "https://example.com"
}
]'

C#:

using System.Text;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("http://localhost:8160/v1/proxies/create_bulk?workspaceId=-1&folderId=123e4567-e89b-12d3-a456-426614174000"),
Headers =
{
{ "Api-Token", "YOUR_SECRET_TOKEN" },
},
};
request.Content = new StringContent("[\n {\n \"proxyUri\": \"http://login:pass@127.0.0.1:8080\",\n \"name\": \"Sample Name\",\n \"ipChangeUrl\": \"https://example.com\"\n }\n]", Encoding.UTF8, "application/json");
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}

Cube:

http://localhost:8160/v1/proxies/create_bulk?workspaceId=-1&folderId=123e4567-e89b-12d3-a456-426614174000

Body (JSON):

[
{
"proxyUri": "http://login:pass@127.0.0.1:8080",
"name": "Sample Name",
"ipChangeUrl": "https://example.com"
}
]

Additionally:
User-Agent: {-Profile.UserAgent-}
Api-Token: Token from UserArea2.

Response API:

Response codeResult
200 OKOK
401 UnauthorizedUnauthorized
403 ForbiddenForbidden
500 Internal Server ErrorInternal Server Error

Success Response (200 OK):

[
"123e4567-e89b-12d3-a456-426614174000"
]

Error Response (500):

{
"message": null
}