import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
access_key_created = client.storage.object_storages.access_keys.create(
0,
)
print(access_key_created.access_key)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
accessKeyCreated, err := client.Storage.ObjectStorages.AccessKeys.New(context.TODO(), 0)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", accessKeyCreated.AccessKey)
}
curl --request POST \
--url https://api.gcore.com/storage/v4/object_storages/{storage_id}/access_keys \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"read_only": false
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({read_only: false})
};
fetch('https://api.gcore.com/storage/v4/object_storages/{storage_id}/access_keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/storage/v4/object_storages/{storage_id}/access_keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'read_only' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/storage/v4/object_storages/{storage_id}/access_keys")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"read_only\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/storage/v4/object_storages/{storage_id}/access_keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"read_only\": false\n}"
response = http.request(request)
puts response.read_body{
"access_key": "AKIAIOSFODNN7EXAMPLE",
"created_at": "2025-08-05T09:17:02Z",
"read_only": true,
"secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Create access key
Creates a new access key for an S3-compatible storage. Returns the new access key and secret key. Standard storages are limited to 10 access keys; Fast storages are limited to 2 access keys.
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
access_key_created = client.storage.object_storages.access_keys.create(
0,
)
print(access_key_created.access_key)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
accessKeyCreated, err := client.Storage.ObjectStorages.AccessKeys.New(context.TODO(), 0)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", accessKeyCreated.AccessKey)
}
curl --request POST \
--url https://api.gcore.com/storage/v4/object_storages/{storage_id}/access_keys \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"read_only": false
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({read_only: false})
};
fetch('https://api.gcore.com/storage/v4/object_storages/{storage_id}/access_keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/storage/v4/object_storages/{storage_id}/access_keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'read_only' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/storage/v4/object_storages/{storage_id}/access_keys")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"read_only\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/storage/v4/object_storages/{storage_id}/access_keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"read_only\": false\n}"
response = http.request(request)
puts response.read_body{
"access_key": "AKIAIOSFODNN7EXAMPLE",
"created_at": "2025-08-05T09:17:02Z",
"read_only": true,
"secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
API key for authentication. Make sure to include the word apikey, followed by a single space and then your token.
Example: apikey 1234_abcdef
Path Parameters
Storage ID
Body
Request a key scoped to read-only data access. Only supported for Standard storages; a Fast storage rejects true. Defaults to false (full read-write) when omitted.
false
Response
AccessKeyCreateDataV4
Access key ID used as the username in S3 authentication. Pass this in the AWS_ACCESS_KEY_ID field of your S3 client.
"AKIAIOSFODNN7EXAMPLE"
ISO 8601 timestamp when the access key was created
"2025-08-05T09:17:02Z"
True for a key scoped to read-only data access.
Secret key used as the password in S3 authentication. Save this now — it cannot be retrieved again.
"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
Was this page helpful?