---
title: "Allocate Flow Storage"
method: POST
path: "/flows/{flowId}/storage"
tags: ["MediaStorage"]
---

# Allocate Flow Storage

`POST /flows/{flowId}/storage`

Allocate storage locations for writing media objects.

The media store type, which is indicated in the /service resource, determines the information provided
in the response. The examples and description below are for the "http_object_store" media store type.
This media store type provides HTTP URLs for uploading and downloading media objects in buckets.

The response will include a PUT URL that a client uses to upload the media object. The client is expected
to register the flow segment using the /flows/{flowId}/segments endpoint once the upload is complete.
Implementations need to handle situations where objects were uploaded but no flow segment was registered
successfully.

The response may include PUT URLs for creating buckets for the media objects. These PUT URLs should
be used before uploading media objects. The object_id associated with each storage location has the
bucket name as its prefix.

The response may include PUT URLs for setting the CORS properties for the buckets and media objects.

When making requests to the provided `put_url`, clients should include credentials if the provided
URL is on the same origin as the API itself, akin to the `same-origin` mode in the
[WhatWG Fetch Standard](https://fetch.spec.whatwg.org/#concept-request-credentials-mode).

## Request body

- Flowstoragepost — Post data for the flow storage endpoint
  - `limit` integer — Limit the number of storage segments in each response page. Implementations may specify their own default and maximum for the limit

## Response `201`

Storage locations for writing media objects.

- Flowstorage — Gives information on storage for media objects. This schema is for the `http_object_store` media store type which provides URLs for storing media objects in bucket, and is the only store type currently implemented.
  - `pre` object[] — Actions that need to be taken before the media object can be written
    - `action` 'create_bucket', required
    - `bucket_id` string — The name of the bucket that needs to be created
    - `put_url` Httprequest — Gives information on a particular http request a client should perform
      - `url` string, required — The URL to make the request to
      - `body` string — The text of the body which needs to be included in the request
      - `content-type` string — The content type which must be used
      - `headers` object — Additional headers that should be included
    - `put_cors_url` Httprequest — Gives information on a particular http request a client should perform
      - `url` string, required — The URL to make the request to
      - `body` string — The text of the body which needs to be included in the request
      - `content-type` string — The content type which must be used
      - `headers` object — Additional headers that should be included
  - `media_objects` object[] — List of information for identifying and uploading media objects
    - `object_id` string, required — The object store identifier for the media object.
    - `put_url` Httprequest, required — Gives information on a particular http request a client should perform
      - `url` string, required — The URL to make the request to
      - `body` string — The text of the body which needs to be included in the request
      - `content-type` string — The content type which must be used
      - `headers` object — Additional headers that should be included
    - `put_cors_url` Httprequest — Gives information on a particular http request a client should perform
      - `url` string, required — The URL to make the request to
      - `body` string — The text of the body which needs to be included in the request
      - `content-type` string — The content type which must be used
      - `headers` object — Additional headers that should be included

## Other responses

- `400` — Bad request. Invalid flow storage request JSON or the flow 'container' is not set.
- `403` — Forbidden. You do not have permission to modify this flow. It may be marked read-only.
- `404` — The requested flow does not exist.

## Changes

- **2025-04-24** `b01aaf8cffe2` — 3 warning, 2 info
  - removed the request property `content_type`
  - removed the request property `object_ids`
  - removed the request property `storage_id`
  - added the optional property `media_objects/items/put_cors_url` to the response with the `201` status
  - …1 more

[Change history](https://skmtc.dev/aws-samples/apis/time-addressable-media-store/changes/flows/:flowId/storage/post.md)

---

[API](https://skmtc.dev/aws-samples/apis/time-addressable-media-store.md) · [All operations](https://skmtc.dev/aws-samples/apis/time-addressable-media-store/llms.txt) · [OpenAPI document](https://skmtc.dev/aws-samples/apis/time-addressable-media-store/revisions/b01aaf8cffe2?raw)
