> For the complete documentation index, see [llms.txt](https://apidocs.zerionsoftware.com/doc/iformbuilder-v80/llms.txt)

# Initiate Media Storage Connection

> POST /media_storage/connections/initiate
> 
> Starts an OAuth connection between the caller's profile and a cloud storage provider. The API builds the consent URL with its own client id; the caller hosts only the redirect page and never sees a client secret or a provider token.
> 
> | `location` | Provider |
> |---|---|
> | `2` | Dropbox (consent requests offline access, so a refresh token is issued) |
> | `3` | Box |
> | `6` | OneDrive |
> | `7` | SharePoint |
> | `8` | Google Drive |
> 
> `redirect_uri` must exactly match an entry of the server's `mediaStorageRedirectUris` configuration.
> 
> `share: true` (Box only) asks for the connection to be shared across the server's profiles. It is decided here and signed into `state`, so the exchange cannot change it; a caller who may not share gets `403` now, before the consent redirect.
> 
> ### Authorization
> 
> Internal clients only, and a SERVER or COMPANY user. `share: true` needs a SERVER user.



## Servers
- https://api.iformbuilder.com/exzact/api/v80/[servername]: https://api.iformbuilder.com/exzact/api/v80/[servername]


## Authentication methods
- Oauth2


## Parameters
### Headers

- **Authorization** (string)
  e.g. Bearer {access_token}




### Body: application/json (object)

- **location** (integer)

- **redirect_uri** (string)

- **share** (boolean)
  Box only, SERVER users only; store the connection as shared across profiles once the code is exchanged



## Responses
### 200
OK - open `consent_url` in the browser. The provider sends the user back to `redirect_uri` with `code` and `state`.

#### Body: application/json (object)
- **consent_url** (string)
  the provider's consent page, built with this server's client id

- **state** (string)
  signed, stateless OAuth state; valid for 15 minutes


### 400
Bad Request - `location` is not one of 2, 3, 6, 7, 8; `share` is not a boolean or is true for a location other than 3; or `redirect_uri` is missing or not on this server's `mediaStorageRedirectUris` allowlist.

### 401
Unauthorized - missing or invalid bearer token.

### 403
Forbidden - the client is not an internal client, the token belongs to a BASIC user, or `share` is true and the user is not a SERVER user.

### 503
Service Unavailable - the provider has no OAuth client credentials on this server.


[Powered by Bump.sh](https://bump.sh)
