# Get Upload Status

GET https://services.leadconnectorhq.com/social-media-posting/{locationId}/csv

Get the status of all CSV imports for a location

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `socialplanner/csv.readonly`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `locationId` | string | Yes | Location ID (also known as Sub-Account ID) for the business location. |

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `skip` | string | No | Number of records to skip |
| `limit` | string | No | Maximum number of records to return |
| `includeUsers` | string | No | Include user data in response |
| `isFromTemplate` | string | No | Filter CSVs imported from template library |
| `userId` | string | Yes | User ID |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/social-media-posting/{locationId}/csv": {
      "get": {
        "summary": "Get Upload Status",
        "operationId": "getUploadStatus",
        "description": "Get the status of all CSV imports for a location",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "locationId",
            "required": true,
            "in": "path",
            "description": "Location ID (also known as Sub-Account ID) for the business location.",
            "schema": {
              "example": "ve9EPM428h8vShlRW1KT",
              "type": "string"
            }
          },
          {
            "name": "skip",
            "required": false,
            "in": "query",
            "description": "Number of records to skip",
            "schema": {
              "default": "0",
              "example": "1",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of records to return",
            "schema": {
              "default": "10",
              "example": "10",
              "type": "string"
            }
          },
          {
            "name": "includeUsers",
            "required": false,
            "in": "query",
            "description": "Include user data in response",
            "schema": {
              "example": "true",
              "type": "string"
            }
          },
          {
            "name": "isFromTemplate",
            "required": false,
            "in": "query",
            "description": "Filter CSVs imported from template library",
            "schema": {
              "example": "true",
              "type": "string"
            }
          },
          {
            "name": "userId",
            "required": true,
            "in": "query",
            "description": "User ID",
            "schema": {
              "example": "sdfdsfdsfEWEsdfsdsW32dd",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetUploadStatusResponseDTO"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "Location-Access": [
              "socialplanner/csv.readonly"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "GetUploadStatusResponseDTO": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "description": "Success or Failure",
            "example": true
          },
          "statusCode": {
            "type": "number",
            "description": "Status Code",
            "example": 200
          },
          "message": {
            "type": "string",
            "description": "Message",
            "example": "Fetched CSV Upload Status"
          },
          "results": {
            "description": "Requested Results",
            "example": {
              "csvs": [
                {
                  "id": "ve9EPM428h8vShlRW1KT",
                  "locationId": "iVrVJ2uoXNF0wzcBzgl5",
                  "fileName": "sample.csv",
                  "status": "completed",
                  "count": 5
                }
              ],
              "count": 6
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "csvs": {
                    "description": "CSV Data",
                    "example": [
                      {
                        "id": "ve9EPM428h8vShlRW1KT",
                        "locationId": "iVrVJ2uoXNF0wzcBzgl5",
                        "fileName": "sample.csv",
                        "status": "completed",
                        "count": 5
                      }
                    ],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "CSV Id",
                          "example": "ve9EPM428h8vShlRW1KT"
                        },
                        "locationId": {
                          "type": "string",
                          "description": "Location Id",
                          "example": "iVrVJ2uoXNF0wzcBzgl5"
                        },
                        "fileName": {
                          "type": "string",
                          "description": "File Name",
                          "example": "sample.csv"
                        },
                        "accountIds": {
                          "description": "Account Ids",
                          "example": [
                            "aF3KhyL8JIuBwzK3m7Ly_iVrVJ2uoXNF0wzcBzgl5_12554616564525983496"
                          ],
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "file": {
                          "type": "string",
                          "description": "File path",
                          "example": "omaDY3RbWtTP511e/social-import/d23d68c2-82c0-1db6e2.csv"
                        },
                        "status": {
                          "type": "string",
                          "description": "CSV import status",
                          "example": "completed",
                          "enum": [
                            "pending",
                            "in_progress",
                            "completed",
                            "failed",
                            "in_review",
                            "importing",
                            "deleted"
                          ]
                        },
                        "count": {
                          "type": "number",
                          "description": "Posts count",
                          "example": 5
                        },
                        "createdBy": {
                          "type": "string",
                          "description": "Created By Id",
                          "example": "SDsdfdf45Dgs4w3ssss"
                        },
                        "traceId": {
                          "type": "string",
                          "description": "Trace ID for debugging",
                          "example": "FSeSDsdfdf45Dgs4w3ssss"
                        },
                        "originId": {
                          "type": "string",
                          "description": "Origin Id",
                          "example": "FSeSDsdfdf45Dgs4w3ssss"
                        },
                        "approver": {
                          "type": "string",
                          "description": "Approver Id",
                          "example": "FSeSDsdfdf45Dgs4w3ssss"
                        },
                        "createdAt": {
                          "format": "date-time",
                          "type": "string",
                          "description": "Date Created",
                          "example": "2023-08-02T00:00:00.000Z"
                        },
                        "csvFileType": {
                          "type": "string",
                          "description": "CSV file type",
                          "example": "basic",
                          "enum": [
                            "basic",
                            "advance"
                          ]
                        },
                        "mediaOptimization": {
                          "type": "boolean",
                          "description": "Media optimization flag",
                          "example": true
                        },
                        "applyWatermark": {
                          "type": "boolean",
                          "description": "Apply watermark flag",
                          "example": false
                        },
                        "channel": {
                          "type": "string",
                          "description": "Channel",
                          "example": "oauth"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string",
                          "description": "Date Updated",
                          "example": "2023-08-02T00:00:00.000Z"
                        }
                      },
                      "required": [
                        "id"
                      ],
                      "title": "CSVImportSchema"
                    }
                  },
                  "count": {
                    "type": "number",
                    "description": "Total count of CSV records",
                    "example": 6
                  }
                },
                "required": [
                  "csvs",
                  "count"
                ],
                "title": "GetUploadStatusResponseSchema"
              }
            ]
          }
        },
        "required": [
          "success",
          "statusCode",
          "message"
        ],
        "title": "GetUploadStatusResponseDTO"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/social-media-posting/<locationId>/csv?userId=<USERID>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3'
```

**Node.js**

```javascript
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3'
  }
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/social-media-posting/<locationId>/csv?userId=<USERID>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/social-media-posting/{locationId}/csv"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

params = {
    "userId": "<USERID>"
}

response = requests.get(url, params=params, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/social-media-posting/<locationId>/csv?userId=<USERID>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
  ],
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/social-media-posting/<locationId>/csv?userId=<USERID>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {
  url := "https://services.leadconnectorhq.com/social-media-posting/<locationId>/csv?userId=<USERID>"
  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/social-media-posting/<locationId>/csv?userId=<USERID>")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/social-media-posting/<locationId>/csv?userId=<USERID>' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
