---
title: Upsert asset hashes
---

[Skip to content](#_top)

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

[Pages](https://developers.cloudflare.com/api/go/resources/pages)

[Assets](https://developers.cloudflare.com/api/go/resources/pages/subresources/assets)

Copy Markdown

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

---

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

# Upsert asset hashes

client.Pages.Assets.UpsertHashes(ctx, body) (\*[AssetUpsertHashesResponse](<https://developers.cloudflare.com/api/go/resources/pages#(resource)%20pages.assets%20%3E%20(model)%20AssetUpsertHashesResponse%20%3E%20(schema)>), error)

POST/pages/assets/upsert-hashes

Register the provided file hashes as recently uploaded to the Pages asset store. Used as part of the Pages Direct Upload workflow so future deployments can avoid re-uploading files that are already present.

Authenticate with the JWT obtained from the upload-token endpoint: GET /accounts/{account\_id}/pages/projects/{project\_name}/upload-token

##### Security

##### ParametersExpand Collapse

<details>

<summary>

body AssetUpsertHashesParams

</summary>

Hashes param.Field\[\[]string]

List of file content hashes to register in the asset store.

<a href="#(resource)%20pages.assets%20%3E%20(method)%20upsert_hashes%20%3E%20(params)%20default%20%3E%20(param)%20hashes">Link to this property</a>

</details>

[Link to this property](<#(resource)%20pages.assets%20%3E%20(method)%20upsert_hashes%20%3E%20(params)%20default>)

##### ReturnsExpand Collapse

<details>

<summary>

type AssetUpsertHashesResponse struct{…}

</summary>

<details>

<summary>

Errors \[]AssetUpsertHashesResponseError

</summary>

Code int64

minimum1000

<a href="#(resource)%20pages.assets%20%3E%20(model)%20AssetUpsertHashesResponse%20%3E%20(schema)%20%3E%20(property)%20errors%20%3E%20(items)%20%3E%20(property)%20code">Link to this property</a>

Message string

<a href="#(resource)%20pages.assets%20%3E%20(model)%20AssetUpsertHashesResponse%20%3E%20(schema)%20%3E%20(property)%20errors%20%3E%20(items)%20%3E%20(property)%20message">Link to this property</a>

DocumentationURL stringOptional

<a href="#(resource)%20pages.assets%20%3E%20(model)%20AssetUpsertHashesResponse%20%3E%20(schema)%20%3E%20(property)%20errors%20%3E%20(items)%20%3E%20(property)%20documentation_url">Link to this property</a>

<details>

<summary>

Source AssetUpsertHashesResponseErrorsSourceOptional

</summary>

Pointer stringOptional

<a href="#(resource)%20pages.assets%20%3E%20(model)%20AssetUpsertHashesResponse%20%3E%20(schema)%20%3E%20(property)%20errors%20%3E%20(items)%20%3E%20(property)%20source%20%3E%20(property)%20pointer">Link to this property</a>

</details>

<a href="#(resource)%20pages.assets%20%3E%20(model)%20AssetUpsertHashesResponse%20%3E%20(schema)%20%3E%20(property)%20errors%20%3E%20(items)%20%3E%20(property)%20source">Link to this property</a>

</details>

<a href="#(resource)%20pages.assets%20%3E%20(model)%20AssetUpsertHashesResponse%20%3E%20(schema)%20%3E%20(property)%20errors">Link to this property</a>

<details>

<summary>

Messages \[]AssetUpsertHashesResponseMessage

</summary>

Code int64

minimum1000

<a href="#(resource)%20pages.assets%20%3E%20(model)%20AssetUpsertHashesResponse%20%3E%20(schema)%20%3E%20(property)%20messages%20%3E%20(items)%20%3E%20(property)%20code">Link to this property</a>

Message string

<a href="#(resource)%20pages.assets%20%3E%20(model)%20AssetUpsertHashesResponse%20%3E%20(schema)%20%3E%20(property)%20messages%20%3E%20(items)%20%3E%20(property)%20message">Link to this property</a>

DocumentationURL stringOptional

<a href="#(resource)%20pages.assets%20%3E%20(model)%20AssetUpsertHashesResponse%20%3E%20(schema)%20%3E%20(property)%20messages%20%3E%20(items)%20%3E%20(property)%20documentation_url">Link to this property</a>

<details>

<summary>

Source AssetUpsertHashesResponseMessagesSourceOptional

</summary>

Pointer stringOptional

<a href="#(resource)%20pages.assets%20%3E%20(model)%20AssetUpsertHashesResponse%20%3E%20(schema)%20%3E%20(property)%20messages%20%3E%20(items)%20%3E%20(property)%20source%20%3E%20(property)%20pointer">Link to this property</a>

</details>

<a href="#(resource)%20pages.assets%20%3E%20(model)%20AssetUpsertHashesResponse%20%3E%20(schema)%20%3E%20(property)%20messages%20%3E%20(items)%20%3E%20(property)%20source">Link to this property</a>

</details>

<a href="#(resource)%20pages.assets%20%3E%20(model)%20AssetUpsertHashesResponse%20%3E%20(schema)%20%3E%20(property)%20messages">Link to this property</a>

Success AssetUpsertHashesResponseSuccess

Whether the API call was successful.

<a href="#(resource)%20pages.assets%20%3E%20(model)%20AssetUpsertHashesResponse%20%3E%20(schema)%20%3E%20(property)%20success">Link to this property</a>

</details>

[Link to this property](<#(resource)%20pages.assets%20%3E%20(model)%20AssetUpsertHashesResponse%20%3E%20(schema)>)

### Upsert asset hashes

Go

HTTPTypeScriptPythonGoTerraform

```
package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/pages"
)

func main() {
  client := cloudflare.NewClient(

  )
  response, err := client.Pages.Assets.UpsertHashes(context.TODO(), pages.AssetUpsertHashesParams{
    Hashes: cloudflare.F([]string{"a948904f2f0f479b8f936b8a0c5d9882", "b026324c6904b2a9cb4b88d6d61c81d1"}),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Errors)
}
```

200 example

```
{
  "errors": [],
  "messages": [],
  "success": true
}
```

##### Returns Examples

200 example

```
{
  "errors": [],
  "messages": [],
  "success": true
}
```