> ## Documentation Index
> Fetch the complete documentation index at: https://gcore.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create bucket

> Creates a new bucket within an S3-compatible storage.



## OpenAPI

````yaml /api-reference/services_documented/object_storage_api.yaml post /storage/v4/object_storages/{storage_id}/buckets
openapi: 3.1.0
info:
  title: Gcore OpenAPI – Object Storage API
  description: >-
    This OpenAPI is an aggregated OpenAPI specification that unifies all Gcore
    products into a single file. It covers Cloud, CDN, DNS, WAAP, DDoS
    Protection, Object Storage, Streaming, and FastEdge services.
  version: '2026-05-15T06:37:28.230198+00:00'
servers:
  - url: https://api.gcore.com
security:
  - APIKey: []
tags:
  - name: Notifications
    x-displayName: Notifications
  - name: SSHKeys
    x-displayName: SSHKeys
  - name: Storage Locations
    x-displayName: Storage Locations
  - name: Storage
    x-displayName: Storage
  - name: Storage Statistics
    x-displayName: Storage Statistics
  - name: S3-Compatible Storage
    x-displayName: S3-Compatible Storage
  - name: SFTP Storage
    x-displayName: SFTP Storage
paths:
  /storage/v4/object_storages/{storage_id}/buckets:
    post:
      tags:
        - S3-Compatible Storage
      summary: Create bucket
      description: Creates a new bucket within an S3-compatible storage.
      operationId: createBucketV4
      parameters:
        - name: storage_id
          in: path
          description: Storage ID
          required: true
          schema:
            type: integer
            format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BucketCreateBodyV4'
        required: true
      responses:
        '201':
          description: BucketDetailResV4
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BucketDetailResV4'
        '400':
          description: ErrResponse
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrResponse'
        '401':
          description: ErrResponse
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrResponse'
        '404':
          description: ErrResponse
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrResponse'
        '409':
          description: ErrResponse
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrResponse'
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from gcore import Gcore

            client = Gcore(
                api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
            )
            bucket = client.storage.object_storages.buckets.create(
                storage_id=0,
                name="my-new-bucket",
            )
            print(bucket.storage_id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/G-Core/gcore-go\"\n\t\"github.com/G-Core/gcore-go/option\"\n\t\"github.com/G-Core/gcore-go/storage\"\n)\n\nfunc main() {\n\tclient := gcore.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbucket, err := client.Storage.ObjectStorages.Buckets.New(\n\t\tcontext.TODO(),\n\t\t0,\n\t\tstorage.ObjectStorageBucketNewParams{\n\t\t\tName: \"my-new-bucket\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", bucket.StorageID)\n}\n"
components:
  schemas:
    BucketCreateBodyV4:
      title: BucketCreateBodyV4 Request body for creating a bucket.
      required:
        - name
      type: object
      properties:
        name:
          type: string
          description: Name of the bucket to create
          example: my-new-bucket
    BucketDetailResV4:
      title: >-
        BucketDetailResV4 Bucket with its current CORS, lifecycle, and access
        policy. Null sub-objects mean not configured.
      required:
        - cors
        - lifecycle
        - name
        - policy
        - storage_id
      type: object
      properties:
        cors:
          $ref: '#/components/schemas/BucketCORSV4'
        lifecycle:
          $ref: '#/components/schemas/BucketLifecycleV4'
        name:
          type: string
          description: >-
            Globally unique bucket name within the storage. Used as the path
            prefix when accessing objects via S3 API.
          example: my-bucket
        policy:
          $ref: '#/components/schemas/BucketPolicyV4'
        storage_id:
          type: integer
          description: >-
            Parent storage this bucket belongs to. Use this ID in the URL path
            for bucket operations.
          format: int64
          example: 123
    ErrResponse:
      type: object
      properties:
        error:
          type: string
      description: ErrResponse is an error response
    BucketCORSV4:
      title: >-
        BucketCORSV4 CORS settings controlling which web domains can access
        objects in this bucket from a browser.
      required:
        - allowed_origins
      type: object
      properties:
        allowed_origins:
          type: array
          description: >-
            Web domains allowed to make direct browser requests to this bucket
            (e.g., "https://myapp.com"). Use "*" to allow any origin.
          example:
            - https://example.com
            - '*'
          items:
            type: string
          x-stainless-terraform-configurability: computed_optional
    BucketLifecycleV4:
      title: >-
        BucketLifecycleV4 Automatic object expiration rule. Objects are
        permanently deleted after the specified number of days.
      required:
        - expiration_days
      type: object
      properties:
        expiration_days:
          type: integer
          description: >-
            Days after upload before objects are automatically deleted. For
            example, 30 means files are removed 30 days after creation.
          format: int64
          example: 30
          x-stainless-terraform-configurability: computed_optional
    BucketPolicyV4:
      title: >-
        BucketPolicyV4 Access policy controlling whether objects in this bucket
        can be read without authentication.
      required:
        - is_public
      type: object
      properties:
        is_public:
          type: boolean
          description: >-
            When true, anyone can download objects without credentials. When
            false, all requests require valid S3 authentication.
          example: true
          x-stainless-terraform-configurability: computed_optional
  securitySchemes:
    APIKey:
      description: >-
        API key for authentication. Make sure to include the word `apikey`,
        followed by a single space and then your token.

        Example: `apikey 1234$abcdef`
      type: apiKey
      in: header
      name: Authorization

````