# Social Accounts

## Add a social account

This API gives you access to adding a social account to your workspace.

{% hint style="info" %}
Steps of filling `credentials` object:

1. Make an API call to [this](https://texau.gitbook.io/api-docs/reference/platforms#api-v1-api-platforms-platformid).
2. You'll get a list of all authVariables, every object in that array will contain key`name`
3. You'll use the value of `name` key, as a key in credentials object, then credentials object will look like this

<pre class="language-json"><code class="lang-json"><strong>"credentials": {
</strong><strong>    "csrf-token": "&#x3C;value>"
</strong><strong>}
</strong></code></pre>

{% endhint %}

{% hint style="info" %}
Steps of filling `platform` object:

1. Use `platformId` for the value of `id`, use [this](https://texau.gitbook.io/api-docs/reference/platforms#api-v1-api-platforms) for getting `platformId`
2. `userId` will be the unique identifier of the user for that platform
3. `picture` will be the profile picture URL
   {% endhint %}

## POST /api/v1/public/social-accounts

>

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"ConnectAccountDto":{"type":"object","properties":{"name":{"type":"string"},"platform":{"$ref":"#/components/schemas/Platform"},"latitude":{"type":"string"},"longitude":{"type":"string"},"variables":{"type":"object"},"credentials":{"type":"object"}},"required":["name","variables","credentials"]},"Platform":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"picture":{"type":"string"},"location":{"type":"string"},"metadata":{"type":"object"}},"required":["id","userId","picture","location","metadata"]},"AddSocialAccountDto":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/AddAccount"}},"required":["success","message","data"]},"AddAccount":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"readyToUse":{"type":"boolean"}},"required":["id","name","readyToUse"]}}},"paths":{"/api/v1/public/social-accounts":{"post":{"operationId":"ApiController_addConnectedAccounts","parameters":[{"name":"X-TexAu-Context","in":"header","description":"Pass orgUserId and workspaceId as ‘{\"orgUserId\":\"123\",\"workspaceId\":\"123\"}’","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectAccountDto"}}}},"responses":{"201":{"description":"Account connected successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddSocialAccountDto"}}}},"401":{"description":"Unauthorized access"},"403":{"description":"Your plan does not have API access"},"422":{"description":"Requested workspace does not belongs to you"},"500":{"description":"Error in adding social account"}},"tags":["API Service"]}}}}
```

## Get All social accounts

This API will return all social accounts of a workspace

## GET /api/v1/public/social-accounts

>

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"GetAccountsDto":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"description":"Array of account data","type":"array","items":{"$ref":"#/components/schemas/AccountData"}}},"required":["success","message","data"]},"AccountData":{"type":"object","properties":{"id":{"type":"string"},"socialAccountName":{"type":"string"},"platformName":{"type":"string"},"proxyId":{"type":"string"},"credentialsIsExpired":{"type":"boolean"},"proxyIsExpired":{"type":"boolean"},"readyToUse":{"type":"boolean"}},"required":["id","socialAccountName","platformName","proxyId","credentialsIsExpired","proxyIsExpired","readyToUse"]}}},"paths":{"/api/v1/public/social-accounts":{"get":{"operationId":"ApiController_getAllSocialAccounts","parameters":[{"name":"X-TexAu-Context","in":"header","description":"Pass orgUserId and workspaceId as ‘{\"orgUserId\":\"123\",\"workspaceId\":\"123\"}’","required":true,"schema":{"type":"string"}},{"name":"start","required":false,"in":"query","schema":{"minimum":0,"type":"number"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":50,"type":"number"}},{"name":"platformId","required":false,"in":"query","description":"The platform ID, must be a valid MongoDB ID","schema":{"type":"string"}},{"name":"onlyReady","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Account listed successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetAccountsDto"}}}},"401":{"description":"Unauthorized access"},"403":{"description":"Your plan does not have API access"},"422":{"description":"Requested workspace does not belongs to you"},"500":{"description":"Error in listing social accounts"}},"tags":["API Service"]}}}}
```

## Get social account by ID

This API will give you social account details by its ID

## GET /api/v1/public/social-accounts/{accountId}

>

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"GetAccountByIdDto":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/SingleAccountData"}},"required":["success","message","data"]},"SingleAccountData":{"type":"object","properties":{"id":{"type":"string"},"socialAccountName":{"type":"string"},"platformName":{"type":"string"},"platformId":{"type":"string"},"credentials":{"type":"object"},"proxyId":{"type":"string"},"variables":{"$ref":"#/components/schemas/Variables"},"limits":{"$ref":"#/components/schemas/AccLimits"},"credentialsIsExpired":{"type":"boolean"},"proxyIsExpired":{"type":"boolean"},"platformUserId":{"type":"string","description":"Platform's unique identifier, e.g. for linkedin, it's linkedin profile URL"},"readyToUse":{"type":"boolean"}},"required":["id","socialAccountName","platformName","platformId","credentials","proxyId","variables","limits","credentialsIsExpired","proxyIsExpired","platformUserId","readyToUse"]},"Variables":{"type":"object","properties":{"key":{"type":"string"}},"required":["key"]},"AccLimits":{"type":"object","properties":{"platformOperationsId":{"type":"array","items":{"$ref":"#/components/schemas/Limit"}}},"required":["platformOperationsId"]},"Limit":{"type":"object","properties":{"limit":{"type":"string"},"interval":{"type":"string"}},"required":["limit","interval"]}}},"paths":{"/api/v1/public/social-accounts/{accountId}":{"get":{"operationId":"ApiController_getSocialAccountById","parameters":[{"name":"X-TexAu-Context","in":"header","description":"Pass orgUserId and workspaceId as ‘{\"orgUserId\":\"123\",\"workspaceId\":\"123\"}’","required":true,"schema":{"type":"string"}},{"name":"accountId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"Account fetched successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetAccountByIdDto"}}}},"401":{"description":"Unauthorized access"},"403":{"description":"Your plan does not have API access"},"404":{"description":"Account not found"},"422":{"description":"Requested workspace does not belongs to you"},"500":{"description":"Error in fetching social account"}},"tags":["API Service"]}}}}
```

## Update a social account

This API will be used for updating the `credential` or `proxy`

## PUT /api/v1/public/social-accounts/{accountId}

>

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"UpdateAccountDto":{"type":"object","properties":{"credentials":{"type":"object"},"variables":{"type":"object"},"name":{"type":"string"},"proxyId":{"type":"string"},"latitude":{"type":"string"},"longitude":{"type":"string"}}},"UpdateSocialAccountDto":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/AddAccount"}},"required":["success","message","data"]},"AddAccount":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"readyToUse":{"type":"boolean"}},"required":["id","name","readyToUse"]}}},"paths":{"/api/v1/public/social-accounts/{accountId}":{"put":{"operationId":"ApiController_updateAccount","parameters":[{"name":"X-TexAu-Context","in":"header","description":"Pass orgUserId and workspaceId as ‘{\"orgUserId\":\"123\",\"workspaceId\":\"123\"}’","required":true,"schema":{"type":"string"}},{"name":"accountId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAccountDto"}}}},"responses":{"200":{"description":"Account updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSocialAccountDto"}}}},"401":{"description":"Unauthorized access"},"403":{"description":"Your plan does not have API access"},"404":{"description":"Account does not exist"},"422":{"description":"Requested workspace does not belongs to you"},"500":{"description":"Error in updating social account"}},"tags":["API Service"]}}}}
```

## Assign proxy to a social account

{% hint style="info" %}
Use this API to assign a proxy to a social account and get `proxyId` from [this](https://texau.gitbook.io/api-docs/reference/proxies#api-v1-api-proxies-1) API.
{% endhint %}

{% hint style="info" %}
Always use a proxy with a social account.
{% endhint %}

## PUT /api/v1/public/social-accounts/{accountId}/proxy

>

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"ProxyIdDto":{"type":"object","properties":{"proxyId":{"type":"string"}},"required":["proxyId"]},"AssignProxyDto":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/AssignProxy"}},"required":["success","message","data"]},"AssignProxy":{"type":"object","properties":{"socialAccountId":{"type":"string"},"proxyId":{"type":"string"}},"required":["socialAccountId","proxyId"]}}},"paths":{"/api/v1/public/social-accounts/{accountId}/proxy":{"put":{"operationId":"ApiController_assignProxy","parameters":[{"name":"X-TexAu-Context","in":"header","description":"Pass orgUserId and workspaceId as ‘{\"orgUserId\":\"123\",\"workspaceId\":\"123\"}’","required":true,"schema":{"type":"string"}},{"name":"accountId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProxyIdDto"}}}},"responses":{"200":{"description":"Proxy assigned successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignProxyDto"}}}},"401":{"description":"Unauthorized access"},"403":{"description":"Your plan does not have API access"},"404":{"description":"Connected account not found."},"422":{"description":"Requested workspace does not belongs to you"},"500":{"description":"Error occurred in assigning proxy to connected account."}},"tags":["API Service"]}}}}
```

## Remove proxy from a social account

Use this API to remove the proxy from the social account.

{% hint style="danger" %}
Not using a proxy may lead to suspending your social account.
{% endhint %}

## DELETE /api/v1/public/social-accounts/{accountId}/proxy

>

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"RemoveProxyDto":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}},"paths":{"/api/v1/public/social-accounts/{accountId}/proxy":{"delete":{"operationId":"ApiController_removeProxyFromAccount","parameters":[{"name":"X-TexAu-Context","in":"header","description":"Pass orgUserId and workspaceId as ‘{\"orgUserId\":\"123\",\"workspaceId\":\"123\"}’","required":true,"schema":{"type":"string"}},{"name":"accountId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"Proxy removed successfully from this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RemoveProxyDto"}}}},"401":{"description":"Unauthorized access"},"403":{"description":"Your plan does not have API access"},"422":{"description":"Requested workspace does not belongs to you"},"500":{"description":"Error in removing proxy from this account"}},"tags":["API Service"]}}}}
```

## Reset proxy of a social account.

{% hint style="info" %}
This API will reset only the factory proxy not the user proxy of a social account.
{% endhint %}

## GET /api/v1/public/social-accounts/{accountId}/reset-proxy

>

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}}},"paths":{"/api/v1/public/social-accounts/{accountId}/reset-proxy":{"get":{"operationId":"ApiController_resetProxyBySocialAccountId","parameters":[{"name":"X-TexAu-Context","in":"header","description":"Pass orgUserId and workspaceId as ‘{\"orgUserId\":\"123\",\"workspaceId\":\"123\"}’","required":true,"schema":{"type":"string"}},{"name":"accountId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"Proxy Location Reset Successfully"},"401":{"description":"Unauthorized access"},"403":{"description":"Your plan does not have API access"},"404":{"description":"Account not found"},"422":{"description":"Proxy you are trying to reset is not factory proxy"}},"tags":["API Service"]}}}}
```

## Set limit

Use this API to set automation limits for the specific social account

## PUT /api/v1/public/social-accounts/{accountId}/limit

>

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"AddOrUpdateLimitDTO":{"type":"object","properties":{"operationId":{"type":"string"},"executionLimit":{"items":{"type":"array"},"type":"array"}},"required":["operationId","executionLimit"]},"UpdateDeleteLimitDto":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/updateDeleteLimit"}},"required":["success","message","data"]},"updateDeleteLimit":{"type":"object","properties":{"socialAccountId":{"type":"string"}},"required":["socialAccountId"]}}},"paths":{"/api/v1/public/social-accounts/{accountId}/limit":{"put":{"operationId":"ApiController_updateAccountLimit","parameters":[{"name":"X-TexAu-Context","in":"header","description":"Pass orgUserId and workspaceId as ‘{\"orgUserId\":\"123\",\"workspaceId\":\"123\"}’","required":true,"schema":{"type":"string"}},{"name":"accountId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddOrUpdateLimitDTO"}}}},"responses":{"200":{"description":"Account limit updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDeleteLimitDto"}}}},"401":{"description":"Unauthorized access"},"403":{"description":"Your plan does not have API access"},"404":{"description":"Account does not exist"},"422":{"description":"Requested workspace does not belongs to you"},"500":{"description":"Error in updating social account limit"}},"tags":["API Service"]}}}}
```

## Reset Limit to default (Delete limit)

Use this API to reset the limit of automation to default one (delete the limit at the account level)

## DELETE /api/v1/public/social-accounts/{accountId}/limit

>

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"DeleteLimitDTO":{"type":"object","properties":{"operationId":{"type":"string"}},"required":["operationId"]},"UpdateDeleteLimitDto":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/updateDeleteLimit"}},"required":["success","message","data"]},"updateDeleteLimit":{"type":"object","properties":{"socialAccountId":{"type":"string"}},"required":["socialAccountId"]}}},"paths":{"/api/v1/public/social-accounts/{accountId}/limit":{"delete":{"operationId":"ApiController_deleteAccountLimit","parameters":[{"name":"X-TexAu-Context","in":"header","description":"Pass orgUserId and workspaceId as ‘{\"orgUserId\":\"123\",\"workspaceId\":\"123\"}’","required":true,"schema":{"type":"string"}},{"name":"accountId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteLimitDTO"}}}},"responses":{"200":{"description":"Account limit deleted successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDeleteLimitDto"}}}},"401":{"description":"Unauthorized access"},"403":{"description":"Your plan does not have API access"},"404":{"description":"Account does not exist"},"422":{"description":"Requested workspace does not belongs to you"},"500":{"description":"Error in deleting social account limit"}},"tags":["API Service"]}}}}
```

## Delete a social account

## DELETE /api/v1/public/social-accounts/{accountId}

>

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"DeleteSocialAccountDto":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/AddAccount"}},"required":["success","message","data"]},"AddAccount":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"readyToUse":{"type":"boolean"}},"required":["id","name","readyToUse"]}}},"paths":{"/api/v1/public/social-accounts/{accountId}":{"delete":{"operationId":"ApiController_deleteAccount","parameters":[{"name":"X-TexAu-Context","in":"header","description":"Pass orgUserId and workspaceId as ‘{\"orgUserId\":\"123\",\"workspaceId\":\"123\"}’","required":true,"schema":{"type":"string"}},{"name":"accountId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"Account deleted successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteSocialAccountDto"}}}},"401":{"description":"Unauthorized access"},"403":{"description":"Your plan does not have API access"},"404":{"description":"Account not found"},"412":{"description":"Account cannot be deleted as it is running in an automation. Please stop and delete automation and retry"},"422":{"description":"Requested workspace does not belongs to you"},"500":{"description":"Error in deleting social account"}},"tags":["API Service"]}}}}
```

## Force Delete a social account

This endpoint is being used when a social account is used in running workflow, and user wish to force delete it.

## DELETE /api/v1/public/social-accounts/{accountId}/force

>

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"DeleteSocialAccountDto":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/AddAccount"}},"required":["success","message","data"]},"AddAccount":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"readyToUse":{"type":"boolean"}},"required":["id","name","readyToUse"]}}},"paths":{"/api/v1/public/social-accounts/{accountId}/force":{"delete":{"operationId":"ApiController_forceDeleteAccount","parameters":[{"name":"X-TexAu-Context","in":"header","description":"Pass orgUserId and workspaceId as ‘{\"orgUserId\":\"123\",\"workspaceId\":\"123\"}’","required":true,"schema":{"type":"string"}},{"name":"accountId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"Account deleted successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteSocialAccountDto"}}}},"401":{"description":"Unauthorized access"},"403":{"description":"Your plan does not have API access"},"404":{"description":"Account not found"},"422":{"description":"Requested workspace does not belongs to you"},"500":{"description":"Error in deleting social account"}},"tags":["API Service"]}}}}
```
