---
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}`

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

---

[API](https://skmtc.net/brightcovelearning/apis/delivery-system-api-reference.md) · [All operations](https://skmtc.net/brightcovelearning/apis/delivery-system-api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/brightcovelearning/delivery-system-api-reference/versions/fd3476e5507a/schema)
