You can use the Google My Business API to upload media with the following two methods:

- [Upload from a URL](https://developers.google.com/my-business/content/upload-photos#upload-from-url).
- [Upload from bytes](https://developers.google.com/my-business/content/upload-photos#upload-from-bytes).

## Upload from a URL

To upload photos from a URL , make the following call to
`Media.Create`. Use the relevant
[category](https://developers.google.com/my-business/reference/rest/v4/accounts.locations.media#category)
as needed.

```
POST https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/media
{
  "mediaFormat": "PHOTO",
  "locationAssociation": {
    "category": "COVER"
  },
  "sourceUrl": "http://example.com/biz/image.jpg"
}
```

To upload videos from a URL with the Google My Business API, make the following call to
`Media.Create`:

```
POST https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/media
{
  "mediaFormat": "VIDEO",
  "locationAssociation": {
    "category": "ADDITIONAL"
  },
  "sourceUrl": "http://example.com/biz/video.mp4"
}
```

## Upload from bytes

To upload media from bytes with the Google My Business API, complete the following steps:

> [!NOTE]
> **Note:** There's only support to upload media from bytes for locations. To include media in a [local post](https://developers.google.com/my-business/reference/rest/v4/accounts.locations.localPosts), you must upload it from a URL.

1. To begin the upload, make the following call:

   ```
     POST https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/media:startUpload
     
   ```

   The response from the API returns a body that contains a `MediaItemDataRef`:

   ```
     {
     "resourceName": "GoogleProvidedValue"
     }
   ```
2. To upload the bytes, use the `resourceName` returned by the call made in the
   previous step. The following is an example where the media to be uploaded is a photo:

   ```
   curl -X POST -T ~/Downloads/pictureToUpload.jpg  "https://mybusiness.googleapis.com/upload/v1/media/{GoogleProvidedValue}?upload_type=media"
   ```

   The following is an example if the media is a video:

   ```
   curl -X POST -T ~/Downloads/videoToUpload.mp4  "https://mybusiness.googleapis.com/upload/v1/media/{GoogleProvidedValue}?upload_type=media"
   ```
3. Use the `resourceName` returned in Step 1 to call `Media.Create`.
   Use the relevant
   [mediaFormat](https://developers.google.com/my-business/reference/rest/v4/accounts.locations.media#mediaformat) and
   [category](https://developers.google.com/my-business/reference/rest/v4/accounts.locations.media#category).

   ```
     POST https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/media
     {
       "mediaFormat": "PHOTO",
       "locationAssociation": {
         "category": "COVER"
       },
       "dataRef": {
         "resourceName": "GoogleProvidedValue"
       }
     }
   ```

   ```
     POST https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/media
     {
       "mediaFormat": "VIDEO",
       "locationAssociation": {
         "category": "ADDITIONAL"
       },
       "dataRef": {
         "resourceName": "GoogleProvidedValue"
       }
     }
   ```