Primer commit
This commit is contained in:
@@ -0,0 +1,914 @@
|
||||
# GHL Media API
|
||||
|
||||
**Endpoints:** 7
|
||||
**Base URL:** `https://rest.gohighlevel.com/v1`
|
||||
|
||||
**Version Header(s):** `2021-07-28`
|
||||
|
||||
---
|
||||
|
||||
## Endpoints
|
||||
|
||||
- [PUT /medias/delete-files](#put--medias-delete-files) — Bulk Delete / Trash Files or Folders
|
||||
- [GET /medias/files](#get--medias-files) — Get List of Files/ Folders
|
||||
- [POST /medias/folder](#post--medias-folder) — Create Folder
|
||||
- [PUT /medias/update-files](#put--medias-update-files) — Bulk Update Files/ Folders
|
||||
- [POST /medias/upload-file](#post--medias-upload-file) — Upload File into Media Storage
|
||||
- [DELETE /medias/{id}](#delete--medias-id) — Delete File or Folder
|
||||
- [POST /medias/{id}](#post--medias-id) — Update File/ Folder
|
||||
|
||||
---
|
||||
|
||||
## PUT /medias/delete-files
|
||||
|
||||
**Summary:** Bulk Delete / Trash Files or Folders
|
||||
|
||||
Soft-deletes or trashes multiple files and folders in a single request
|
||||
|
||||
**Version Header:** `2021-07-28`
|
||||
|
||||
**Operation ID:** `bulk-delete-media-objects`
|
||||
|
||||
**Tags:** Medias
|
||||
|
||||
### cURL
|
||||
|
||||
```bash
|
||||
curl -X PUT 'https://rest.gohighlevel.com/v1/medias/delete-files' \
|
||||
-H 'Authorization: Bearer YOUR_API_TOKEN' \
|
||||
-H 'Version: 2021-07-28' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'User-Agent: YourApp/1.0' \
|
||||
-d '{}' # See request body schema below
|
||||
```
|
||||
|
||||
### Python (http.client)
|
||||
|
||||
```python
|
||||
import http.client
|
||||
import json
|
||||
|
||||
conn = http.client.HTTPSConnection('rest.gohighlevel.com')
|
||||
|
||||
headers = {
|
||||
'Authorization': 'Bearer YOUR_API_TOKEN',
|
||||
'Version': '2021-07-28',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'User-Agent': 'YourApp/1.0',
|
||||
}
|
||||
|
||||
payload = json.dumps({})
|
||||
conn.request('PUT', '/v1/medias/delete-files', body=payload, headers=headers)
|
||||
|
||||
response = conn.getresponse()
|
||||
data = json.loads(response.read().decode())
|
||||
print(json.dumps(data, indent=2))
|
||||
conn.close()
|
||||
```
|
||||
|
||||
### n8n HTTP Node
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "GHL - PUT delete-files",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"parameters": {
|
||||
"method": "PUT",
|
||||
"url": "https://rest.gohighlevel.com/v1/medias/delete-files",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Authorization",
|
||||
"value": "Bearer YOUR_API_TOKEN"
|
||||
},
|
||||
{
|
||||
"name": "Version",
|
||||
"value": "2021-07-28"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "Accept",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "User-Agent",
|
||||
"value": "YourApp/1.0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"bodyParameters": {
|
||||
"parameters": []
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**To use in n8n:**
|
||||
1. Add an HTTP Request node
|
||||
2. Switch to JSON mode (Parameters → use RAW JSON)
|
||||
3. Paste the JSON above
|
||||
4. Update `YOUR_API_TOKEN` with your actual GHL API key
|
||||
|
||||
### Request Body Schema
|
||||
|
||||
- **filesToBeDeleted** (array of DeleteMediaObjectItem) (required) (e.g. `[{'_id': '686f630df0d3166d68fbcec2'}]`): Array of file objects to be deleted or trashed
|
||||
- **altType** (string) (required) (e.g. `location`): Type of entity that owns the files
|
||||
- **altId** (string) (required) (e.g. `sx6wyHhbFdRXh302LLNR`): Location identifier
|
||||
- **status** (string) (required) (e.g. `deleted`): Status to set for the files (deleted or trashed)
|
||||
|
||||
### Response Codes
|
||||
|
||||
| Code | Description | Schema |
|
||||
|------|-------------|--------|
|
||||
| `200` | Successful response | object — no documented properties |
|
||||
|
||||
### ⚠️ Special Notes & Quirks
|
||||
|
||||
> ⚠️ **User-Agent Required:** All GHL API requests require a `User-Agent` HTTP header. Requests without it may be rejected with a 403 error.
|
||||
|
||||
---
|
||||
|
||||
## GET /medias/files
|
||||
|
||||
**Summary:** Get List of Files/ Folders
|
||||
|
||||
Fetches list of files and folders from the media storage
|
||||
|
||||
**Version Header:** `2021-07-28`
|
||||
|
||||
**Operation ID:** `fetch-media-content`
|
||||
|
||||
**Tags:** Medias
|
||||
|
||||
### cURL
|
||||
|
||||
```bash
|
||||
curl -X GET 'https://rest.gohighlevel.com/v1/medias/files?offset=VALUE&limit=VALUE&sortBy=VALUE&sortOrder=VALUE&type=VALUE&query=VALUE&altType=location&altId=VALUE&parentId=VALUE&fetchAll=VALUE' \
|
||||
-H 'Authorization: Bearer YOUR_API_TOKEN' \
|
||||
-H 'Version: 2021-07-28' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'User-Agent: YourApp/1.0'
|
||||
```
|
||||
|
||||
### Python (http.client)
|
||||
|
||||
```python
|
||||
import http.client
|
||||
import json
|
||||
|
||||
conn = http.client.HTTPSConnection('rest.gohighlevel.com')
|
||||
|
||||
headers = {
|
||||
'Authorization': 'Bearer YOUR_API_TOKEN',
|
||||
'Version': '2021-07-28',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'User-Agent': 'YourApp/1.0',
|
||||
}
|
||||
|
||||
conn.request('GET', '/v1/medias/files?offset=VALUE&limit=VALUE&sortBy=VALUE&sortOrder=VALUE&type=VALUE&query=VALUE&altType=VALUE&altId=VALUE&parentId=VALUE&fetchAll=VALUE', headers=headers)
|
||||
|
||||
response = conn.getresponse()
|
||||
data = json.loads(response.read().decode())
|
||||
print(json.dumps(data, indent=2))
|
||||
conn.close()
|
||||
```
|
||||
|
||||
### n8n HTTP Node
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "GHL - GET files",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"parameters": {
|
||||
"method": "GET",
|
||||
"url": "https://rest.gohighlevel.com/v1/medias/files",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Authorization",
|
||||
"value": "Bearer YOUR_API_TOKEN"
|
||||
},
|
||||
{
|
||||
"name": "Version",
|
||||
"value": "2021-07-28"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "Accept",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "User-Agent",
|
||||
"value": "YourApp/1.0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": false,
|
||||
"bodyParameters": {
|
||||
"parameters": []
|
||||
},
|
||||
"options": {},
|
||||
"sendQuery": true,
|
||||
"queryParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "offset",
|
||||
"value": "VALUE"
|
||||
},
|
||||
{
|
||||
"name": "limit",
|
||||
"value": "VALUE"
|
||||
},
|
||||
{
|
||||
"name": "sortBy",
|
||||
"value": "VALUE"
|
||||
},
|
||||
{
|
||||
"name": "sortOrder",
|
||||
"value": "VALUE"
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"value": "VALUE"
|
||||
},
|
||||
{
|
||||
"name": "query",
|
||||
"value": "VALUE"
|
||||
},
|
||||
{
|
||||
"name": "altType",
|
||||
"value": "VALUE"
|
||||
},
|
||||
{
|
||||
"name": "altId",
|
||||
"value": "VALUE"
|
||||
},
|
||||
{
|
||||
"name": "parentId",
|
||||
"value": "VALUE"
|
||||
},
|
||||
{
|
||||
"name": "fetchAll",
|
||||
"value": "VALUE"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**To use in n8n:**
|
||||
1. Add an HTTP Request node
|
||||
2. Switch to JSON mode (Parameters → use RAW JSON)
|
||||
3. Paste the JSON above
|
||||
4. Update `YOUR_API_TOKEN` with your actual GHL API key
|
||||
|
||||
### Request Parameters
|
||||
|
||||
| Name | Location | Type | Required | Description |
|
||||
|------|----------|------|----------|-------------|
|
||||
| `offset` | Query | `string` | — | Number of files to skip in listing |
|
||||
| `limit` | Query | `string` | — | Number of files to show in the listing |
|
||||
| `sortBy` | Query | `string` | ✅ | Field to sorting the file listing by |
|
||||
| `sortOrder` | Query | `string` | ✅ | Direction in which file needs to be sorted |
|
||||
| `type` | Query | `string` | ✅ | Type |
|
||||
| `query` | Query | `string` | — | Query text |
|
||||
| `altType` | Query | `string` | ✅ | AltType (values: location) |
|
||||
| `altId` | Query | `string` | ✅ | location Id |
|
||||
| `parentId` | Query | `string` | — | parent id or folder id |
|
||||
| `fetchAll` | Query | `string` | — | Fetch all files or folders |
|
||||
|
||||
### Response Codes
|
||||
|
||||
| Code | Description | Schema |
|
||||
|------|-------------|--------|
|
||||
| `200` | Successful response | - **files** (array) (required) (e.g. `{'altId': 'locationId', 'altType': 'location', 'name': 'file name', 'parentId': 'parent folder id', 'url': ... |
|
||||
|
||||
### ⚠️ Special Notes & Quirks
|
||||
|
||||
> ⚠️ **User-Agent Required:** All GHL API requests require a `User-Agent` HTTP header. Requests without it may be rejected with a 403 error.
|
||||
|
||||
---
|
||||
|
||||
## POST /medias/folder
|
||||
|
||||
**Summary:** Create Folder
|
||||
|
||||
Creates a new folder in the media storage
|
||||
|
||||
**Version Header:** `2021-07-28`
|
||||
|
||||
**Operation ID:** `create-media-folder`
|
||||
|
||||
**Tags:** Medias
|
||||
|
||||
### cURL
|
||||
|
||||
```bash
|
||||
curl -X POST 'https://rest.gohighlevel.com/v1/medias/folder' \
|
||||
-H 'Authorization: Bearer YOUR_API_TOKEN' \
|
||||
-H 'Version: 2021-07-28' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'User-Agent: YourApp/1.0' \
|
||||
-d '{}' # See request body schema below
|
||||
```
|
||||
|
||||
### Python (http.client)
|
||||
|
||||
```python
|
||||
import http.client
|
||||
import json
|
||||
|
||||
conn = http.client.HTTPSConnection('rest.gohighlevel.com')
|
||||
|
||||
headers = {
|
||||
'Authorization': 'Bearer YOUR_API_TOKEN',
|
||||
'Version': '2021-07-28',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'User-Agent': 'YourApp/1.0',
|
||||
}
|
||||
|
||||
payload = json.dumps({})
|
||||
conn.request('POST', '/v1/medias/folder', body=payload, headers=headers)
|
||||
|
||||
response = conn.getresponse()
|
||||
data = json.loads(response.read().decode())
|
||||
print(json.dumps(data, indent=2))
|
||||
conn.close()
|
||||
```
|
||||
|
||||
### n8n HTTP Node
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "GHL - POST folder",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "https://rest.gohighlevel.com/v1/medias/folder",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Authorization",
|
||||
"value": "Bearer YOUR_API_TOKEN"
|
||||
},
|
||||
{
|
||||
"name": "Version",
|
||||
"value": "2021-07-28"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "Accept",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "User-Agent",
|
||||
"value": "YourApp/1.0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"bodyParameters": {
|
||||
"parameters": []
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**To use in n8n:**
|
||||
1. Add an HTTP Request node
|
||||
2. Switch to JSON mode (Parameters → use RAW JSON)
|
||||
3. Paste the JSON above
|
||||
4. Update `YOUR_API_TOKEN` with your actual GHL API key
|
||||
|
||||
### Request Body Schema
|
||||
|
||||
- **altId** (string) (required) (e.g. `sx6wyHhbFdRXh302LLNR`): Location Id
|
||||
- **altType** (string) (required) (e.g. `location`): Type of entity (location only)
|
||||
- **name** (string) (required) (e.g. `New Folder`): Name of the folder to be created
|
||||
- **parentId** (string) (e.g. `64af50c42d567a3b4f5989e0`): ID of the parent folder (optional)
|
||||
|
||||
### Response Codes
|
||||
|
||||
| Code | Description | Schema |
|
||||
|------|-------------|--------|
|
||||
| `200` | Returns the newly created folder object | - **altId** (string) (required) (e.g. `sx6wyHhbFdRXh302LLNR`): Location identifier that owns this folder<br> - **altType** (string) (required) (e.g... |
|
||||
|
||||
### ⚠️ Special Notes & Quirks
|
||||
|
||||
> ⚠️ **User-Agent Required:** All GHL API requests require a `User-Agent` HTTP header. Requests without it may be rejected with a 403 error.
|
||||
|
||||
---
|
||||
|
||||
## PUT /medias/update-files
|
||||
|
||||
**Summary:** Bulk Update Files/ Folders
|
||||
|
||||
Updates metadata or status of multiple files and folders
|
||||
|
||||
**Version Header:** `2021-07-28`
|
||||
|
||||
**Operation ID:** `bulk-update-media-objects`
|
||||
|
||||
**Tags:** Medias
|
||||
|
||||
### cURL
|
||||
|
||||
```bash
|
||||
curl -X PUT 'https://rest.gohighlevel.com/v1/medias/update-files' \
|
||||
-H 'Authorization: Bearer YOUR_API_TOKEN' \
|
||||
-H 'Version: 2021-07-28' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'User-Agent: YourApp/1.0' \
|
||||
-d '{}' # See request body schema below
|
||||
```
|
||||
|
||||
### Python (http.client)
|
||||
|
||||
```python
|
||||
import http.client
|
||||
import json
|
||||
|
||||
conn = http.client.HTTPSConnection('rest.gohighlevel.com')
|
||||
|
||||
headers = {
|
||||
'Authorization': 'Bearer YOUR_API_TOKEN',
|
||||
'Version': '2021-07-28',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'User-Agent': 'YourApp/1.0',
|
||||
}
|
||||
|
||||
payload = json.dumps({})
|
||||
conn.request('PUT', '/v1/medias/update-files', body=payload, headers=headers)
|
||||
|
||||
response = conn.getresponse()
|
||||
data = json.loads(response.read().decode())
|
||||
print(json.dumps(data, indent=2))
|
||||
conn.close()
|
||||
```
|
||||
|
||||
### n8n HTTP Node
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "GHL - PUT update-files",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"parameters": {
|
||||
"method": "PUT",
|
||||
"url": "https://rest.gohighlevel.com/v1/medias/update-files",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Authorization",
|
||||
"value": "Bearer YOUR_API_TOKEN"
|
||||
},
|
||||
{
|
||||
"name": "Version",
|
||||
"value": "2021-07-28"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "Accept",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "User-Agent",
|
||||
"value": "YourApp/1.0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"bodyParameters": {
|
||||
"parameters": []
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**To use in n8n:**
|
||||
1. Add an HTTP Request node
|
||||
2. Switch to JSON mode (Parameters → use RAW JSON)
|
||||
3. Paste the JSON above
|
||||
4. Update `YOUR_API_TOKEN` with your actual GHL API key
|
||||
|
||||
### Request Body Schema
|
||||
|
||||
- **altId** (string) (required) (e.g. `sx6wyHhbFdRXh302LLNR`): Location identifier
|
||||
- **altType** (string) (required) (e.g. `location`): Type of entity that owns the files
|
||||
- **filesToBeUpdated** (array of UpdateMediaObject) (required) (e.g. `[{'id': '686f9817f0d3165be9fbcef6', 'name': 'Updated File Name.pdf'}]`): Array of file objects to be updated
|
||||
|
||||
### Response Codes
|
||||
|
||||
| Code | Description | Schema |
|
||||
|------|-------------|--------|
|
||||
| `200` | Successful response | object — no documented properties |
|
||||
|
||||
### ⚠️ Special Notes & Quirks
|
||||
|
||||
> ⚠️ **User-Agent Required:** All GHL API requests require a `User-Agent` HTTP header. Requests without it may be rejected with a 403 error.
|
||||
|
||||
---
|
||||
|
||||
## POST /medias/upload-file
|
||||
|
||||
**Summary:** Upload File into Media Storage
|
||||
|
||||
If hosted is set to true then fileUrl is required. Else file is required. If adding a file, maximum allowed is 25 MB
|
||||
|
||||
**Version Header:** `2021-07-28`
|
||||
|
||||
**Operation ID:** `upload-media-content`
|
||||
|
||||
**Tags:** Medias
|
||||
|
||||
### cURL
|
||||
|
||||
```bash
|
||||
curl -X POST 'https://rest.gohighlevel.com/v1/medias/upload-file' \
|
||||
-H 'Authorization: Bearer YOUR_API_TOKEN' \
|
||||
-H 'Version: 2021-07-28' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'User-Agent: YourApp/1.0'
|
||||
```
|
||||
|
||||
### Python (http.client)
|
||||
|
||||
```python
|
||||
import http.client
|
||||
import json
|
||||
|
||||
conn = http.client.HTTPSConnection('rest.gohighlevel.com')
|
||||
|
||||
headers = {
|
||||
'Authorization': 'Bearer YOUR_API_TOKEN',
|
||||
'Version': '2021-07-28',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'User-Agent': 'YourApp/1.0',
|
||||
}
|
||||
|
||||
conn.request('POST', '/v1/medias/upload-file', headers=headers)
|
||||
|
||||
response = conn.getresponse()
|
||||
data = json.loads(response.read().decode())
|
||||
print(json.dumps(data, indent=2))
|
||||
conn.close()
|
||||
```
|
||||
|
||||
### n8n HTTP Node
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "GHL - POST upload-file",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "https://rest.gohighlevel.com/v1/medias/upload-file",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Authorization",
|
||||
"value": "Bearer YOUR_API_TOKEN"
|
||||
},
|
||||
{
|
||||
"name": "Version",
|
||||
"value": "2021-07-28"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "Accept",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "User-Agent",
|
||||
"value": "YourApp/1.0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"bodyParameters": {
|
||||
"parameters": []
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**To use in n8n:**
|
||||
1. Add an HTTP Request node
|
||||
2. Switch to JSON mode (Parameters → use RAW JSON)
|
||||
3. Paste the JSON above
|
||||
4. Update `YOUR_API_TOKEN` with your actual GHL API key
|
||||
|
||||
### Response Codes
|
||||
|
||||
| Code | Description | Schema |
|
||||
|------|-------------|--------|
|
||||
| `200` | Successful response | - **fileId** (string) (required) (e.g. `file.pdf`): ID of the uploaded file<br> - **url** (string) (required) (e.g. `https://storage.googleapis.com... |
|
||||
|
||||
### ⚠️ Special Notes & Quirks
|
||||
|
||||
> ⚠️ **User-Agent Required:** All GHL API requests require a `User-Agent` HTTP header. Requests without it may be rejected with a 403 error.
|
||||
|
||||
---
|
||||
|
||||
## DELETE /medias/{id}
|
||||
|
||||
**Summary:** Delete File or Folder
|
||||
|
||||
Deletes specific file or folder from the media storage
|
||||
|
||||
**Version Header:** `2021-07-28`
|
||||
|
||||
**Operation ID:** `delete-media-content`
|
||||
|
||||
**Tags:** Medias
|
||||
|
||||
### cURL
|
||||
|
||||
```bash
|
||||
curl -X DELETE 'https://rest.gohighlevel.com/v1/medias/VALUE?altType=location&altId=VALUE' \
|
||||
-H 'Authorization: Bearer YOUR_API_TOKEN' \
|
||||
-H 'Version: 2021-07-28' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'User-Agent: YourApp/1.0'
|
||||
```
|
||||
|
||||
### Python (http.client)
|
||||
|
||||
```python
|
||||
import http.client
|
||||
import json
|
||||
|
||||
conn = http.client.HTTPSConnection('rest.gohighlevel.com')
|
||||
|
||||
headers = {
|
||||
'Authorization': 'Bearer YOUR_API_TOKEN',
|
||||
'Version': '2021-07-28',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'User-Agent': 'YourApp/1.0',
|
||||
}
|
||||
|
||||
conn.request('DELETE', '/v1/medias/VALUE?altType=VALUE&altId=VALUE', headers=headers)
|
||||
|
||||
response = conn.getresponse()
|
||||
data = json.loads(response.read().decode())
|
||||
print(json.dumps(data, indent=2))
|
||||
conn.close()
|
||||
```
|
||||
|
||||
### n8n HTTP Node
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "GHL - DELETE VALUE",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"parameters": {
|
||||
"method": "DELETE",
|
||||
"url": "https://rest.gohighlevel.com/v1/medias/VALUE",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Authorization",
|
||||
"value": "Bearer YOUR_API_TOKEN"
|
||||
},
|
||||
{
|
||||
"name": "Version",
|
||||
"value": "2021-07-28"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "Accept",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "User-Agent",
|
||||
"value": "YourApp/1.0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": false,
|
||||
"bodyParameters": {
|
||||
"parameters": []
|
||||
},
|
||||
"options": {},
|
||||
"sendQuery": true,
|
||||
"queryParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "altType",
|
||||
"value": "VALUE"
|
||||
},
|
||||
{
|
||||
"name": "altId",
|
||||
"value": "VALUE"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**To use in n8n:**
|
||||
1. Add an HTTP Request node
|
||||
2. Switch to JSON mode (Parameters → use RAW JSON)
|
||||
3. Paste the JSON above
|
||||
4. Update `YOUR_API_TOKEN` with your actual GHL API key
|
||||
|
||||
### Request Parameters
|
||||
|
||||
| Name | Location | Type | Required | Description |
|
||||
|------|----------|------|----------|-------------|
|
||||
| `id` | Path | `string` | ✅ | |
|
||||
| `altType` | Query | `string` | ✅ | AltType (values: location) |
|
||||
| `altId` | Query | `string` | ✅ | location Id |
|
||||
|
||||
### Response Codes
|
||||
|
||||
| Code | Description | Schema |
|
||||
|------|-------------|--------|
|
||||
| `200` | Successful response | — |
|
||||
|
||||
### ⚠️ Special Notes & Quirks
|
||||
|
||||
> ⚠️ **User-Agent Required:** All GHL API requests require a `User-Agent` HTTP header. Requests without it may be rejected with a 403 error.
|
||||
|
||||
---
|
||||
|
||||
## POST /medias/{id}
|
||||
|
||||
**Summary:** Update File/ Folder
|
||||
|
||||
Updates a single file or folder by ID
|
||||
|
||||
**Version Header:** `2021-07-28`
|
||||
|
||||
**Operation ID:** `update-media-object`
|
||||
|
||||
**Tags:** Medias
|
||||
|
||||
### cURL
|
||||
|
||||
```bash
|
||||
curl -X POST 'https://rest.gohighlevel.com/v1/medias/VALUE' \
|
||||
-H 'Authorization: Bearer YOUR_API_TOKEN' \
|
||||
-H 'Version: 2021-07-28' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'User-Agent: YourApp/1.0' \
|
||||
-d '{}' # See request body schema below
|
||||
```
|
||||
|
||||
### Python (http.client)
|
||||
|
||||
```python
|
||||
import http.client
|
||||
import json
|
||||
|
||||
conn = http.client.HTTPSConnection('rest.gohighlevel.com')
|
||||
|
||||
headers = {
|
||||
'Authorization': 'Bearer YOUR_API_TOKEN',
|
||||
'Version': '2021-07-28',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'User-Agent': 'YourApp/1.0',
|
||||
}
|
||||
|
||||
payload = json.dumps({})
|
||||
conn.request('POST', '/v1/medias/VALUE', body=payload, headers=headers)
|
||||
|
||||
response = conn.getresponse()
|
||||
data = json.loads(response.read().decode())
|
||||
print(json.dumps(data, indent=2))
|
||||
conn.close()
|
||||
```
|
||||
|
||||
### n8n HTTP Node
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "GHL - POST VALUE",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "https://rest.gohighlevel.com/v1/medias/VALUE",
|
||||
"authentication": "genericCredentialType",
|
||||
"genericAuthType": "httpHeaderAuth",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Authorization",
|
||||
"value": "Bearer YOUR_API_TOKEN"
|
||||
},
|
||||
{
|
||||
"name": "Version",
|
||||
"value": "2021-07-28"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "Accept",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "User-Agent",
|
||||
"value": "YourApp/1.0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"bodyParameters": {
|
||||
"parameters": []
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**To use in n8n:**
|
||||
1. Add an HTTP Request node
|
||||
2. Switch to JSON mode (Parameters → use RAW JSON)
|
||||
3. Paste the JSON above
|
||||
4. Update `YOUR_API_TOKEN` with your actual GHL API key
|
||||
|
||||
### Request Parameters
|
||||
|
||||
| Name | Location | Type | Required | Description |
|
||||
|------|----------|------|----------|-------------|
|
||||
| `id` | Path | `string` | ✅ | Unique identifier of the file or folder to update |
|
||||
|
||||
### Request Body Schema
|
||||
|
||||
- **name** (string) (required) (e.g. `Updated File Name.pdf`): New name for the file or folder
|
||||
- **altType** (string) (required) (e.g. `location`): Type of entity that owns the file or folder
|
||||
- **altId** (string) (required) (e.g. `sx6wyHhbFdRXh302LLNR`): Location identifier that owns the file or folder
|
||||
|
||||
### Response Codes
|
||||
|
||||
| Code | Description | Schema |
|
||||
|------|-------------|--------|
|
||||
| `200` | Successful response | object — no documented properties |
|
||||
|
||||
### ⚠️ Special Notes & Quirks
|
||||
|
||||
> ⚠️ **User-Agent Required:** All GHL API requests require a `User-Agent` HTTP header. Requests without it may be rejected with a 403 error.
|
||||
|
||||
---
|
||||
|
||||
|
||||
*Documentation generated from GHL OpenAPI specifications. Verify against official docs for latest changes.*
|
||||
Reference in New Issue
Block a user