---
title: Posts a file to Binary Storage
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/go)

[Cloudforce One](https://developers.cloudflare.com/api/go/resources/cloudforce_one)

[Binary Storage](https://developers.cloudflare.com/api/go/resources/cloudforce_one/subresources/binary_storage)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Posts a file to Binary Storage

client.CloudforceOne.BinaryStorage.New(ctx, params) (\*[BinaryStorageNewResponse](<https://developers.cloudflare.com/api/go/resources/cloudforce_one#(resource)%20cloudforce_one.binary_storage%20%3E%20(model)%20BinaryStorageNewResponse%20%3E%20(schema)>), error)

POST/accounts/{account\_id}/cloudforce-one/binary

Uploads a binary file to Cloudforce One’s binary database for malware analysis and threat intelligence correlation.

##### Security

API Token

The preferred authorization scheme for interacting with the Cloudflare API. [Create a token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/).

**Example:**`Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY`

##### Accepted Permissions (at least one required)

`Cloudforce One Write``Cloudforce One Read`

##### ParametersExpand Collapse

<details>

<summary>

params BinaryStorageNewParams

</summary>

AccountID param.Field\[string]

Path param: Account ID.

<a href="#(resource)%20cloudforce_one.binary_storage%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20account_id">Link to this property</a>

File param.Field\[<a href="https://developers.cloudflare.com/api/go/resources/cloudforce_one/subresources/binary_storage/methods/create#(resource)%20cloudforce_one.binary_storage%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20file%20%3E%20(schema)">Reader</a>]

Body param: The binary file content to upload.

<a href="#(resource)%20cloudforce_one.binary_storage%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20file">Link to this property</a>

</details>

[Link to this property](<#(resource)%20cloudforce_one.binary_storage%20%3E%20(method)%20create%20%3E%20(params)%20default>)

##### ReturnsExpand Collapse

<details>

<summary>

type BinaryStorageNewResponse struct{…}

</summary>

ContentType string

<a href="#(resource)%20cloudforce_one.binary_storage%20%3E%20(model)%20BinaryStorageNewResponse%20%3E%20(schema)%20%3E%20(property)%20content_type">Link to this property</a>

Md5 string

<a href="#(resource)%20cloudforce_one.binary_storage%20%3E%20(model)%20BinaryStorageNewResponse%20%3E%20(schema)%20%3E%20(property)%20md5">Link to this property</a>

Sha1 string

<a href="#(resource)%20cloudforce_one.binary_storage%20%3E%20(model)%20BinaryStorageNewResponse%20%3E%20(schema)%20%3E%20(property)%20sha1">Link to this property</a>

Sha256 string

<a href="#(resource)%20cloudforce_one.binary_storage%20%3E%20(model)%20BinaryStorageNewResponse%20%3E%20(schema)%20%3E%20(property)%20sha256">Link to this property</a>

</details>

[Link to this property](<#(resource)%20cloudforce_one.binary_storage%20%3E%20(model)%20BinaryStorageNewResponse%20%3E%20(schema)>)

### Posts a file to Binary Storage

Go

HTTPTypeScriptPythonGoTerraform

```
package main

import (
  "bytes"
  "context"
  "fmt"
  "io"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/cloudforce_one"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  binaryStorage, err := client.CloudforceOne.BinaryStorage.New(context.TODO(), cloudforce_one.BinaryStorageNewParams{
    AccountID: cloudflare.F("account_id"),
    File: cloudflare.F(io.Reader(bytes.NewBuffer([]byte("Example data")))),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", binaryStorage.ContentType)
}
```

200 example

```
{
  "content_type": "text/plain",
  "md5": "5d84ade76d2a8387c81175bb0cbe6492",
  "sha1": "9aff6879626d957eafadda044e4f879aae1e7278",
  "sha256": "0000a7f2692ef479e2e3d02661568882cadec451cc8a64d4e7faca29810cd626"
}
```

##### Returns Examples

200 example

```
{
  "content_type": "text/plain",
  "md5": "5d84ade76d2a8387c81175bb0cbe6492",
  "sha1": "9aff6879626d957eafadda044e4f879aae1e7278",
  "sha256": "0000a7f2692ef479e2e3d02661568882cadec451cc8a64d4e7faca29810cd626"
}
```