---
title: "Add or Update File in Repository"
method: PUT
path: "/accounts/{{account_id}}/repos/{repo_name}/files/{filename}"
tags: ["Files"]
---

# Add or Update File in Repository

`PUT /accounts/{{account_id}}/repos/{repo_name}/files/{filename}`

## Request

- Base URL: `https://repos.api.brightcove.com/v1`
- URL: `https://repos.api.brightcove.com/v1/accounts/{{account_id}}/repos/{repo_name}/files/{filename}`
- Auth: OAuth 2
  - Client credentials
  - Token URL: `https://oauth.brightcove.com/v4/access_token` scopes: `video-cloud/player/all`

This will add or update a file. The wanted file name is at the end of the endpoint. The form contents can be a file name, including relative path, or any string. If the file has a .json extension, it will be checked for valid JSON format.

A multi-part form with a `contents` key must be used to PUT a repo file. Note that you should add files using this endpoint and CURL rather than using git commands. Here is a CURL example:

<pre><code translate="No">curl \
--user $EMAIL \
--form contents=@first-plugin.js \
--request PUT \
https://repos.api.brightcove.com/v1/accounts/{{account_id}}/repos/firstRepo/files/first-plugin.js</code></pre>

## Path parameters

- `account_id` string, required
- `repo_name` string, required
- `filename` string, required

## Headers

- `Authorization` string, required

## Response `200`

200

- AddUpdateFileResponse
  - `name` string, required: Destination filename
  - `public_url` string, required: URL to use for referencing the file (contrasted to the repo URL)

## Other responses

- `401`: UNAUTHORIZED: Authentication failed; check to make sure your client credentials were correct for the access token
- `404`: RESOURCE_NOT_FOUND: The api couldn&#39;t find the resource you requested

## Changes

- **2023-03-26** `fd3476e5507a`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/brightcovelearning/apis/delivery-system-api-reference/changes/accounts/:{account_id}/repos/:repo_name/files/:filename/put.md)

---

[API](https://skmtc.dev/brightcovelearning/apis/delivery-system-api-reference.md) - [All operations](https://skmtc.dev/brightcovelearning/apis/delivery-system-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/brightcovelearning/apis/delivery-system-api-reference/revisions/fd3476e5507a?raw)
