> This page is for Developer.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.bigcommerce.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.bigcommerce.com/_mcp/server.

# Create Store Login URL

POST https://api.bigcommerce.com/franchises/franchise_uuid/v1/stores/{store_id}/login-url
Content-Type: application/json

`POST` `/stores/{store_id}/login-url` allows you to create a one-time login URL to redirect a merchant to their store control panel. You need to use a form to send a `POST` request and redirect the merchant’s browser to the action URL because most browsers only support `GET` requests in the address bar.

```javascript title=Sample Form Request
loginForm = document.createElement("form");
loginForm.setAttribute("method", "post");
loginForm.setAttribute("action", "store login URL returned from endpoint");
document.getElementsByTagName("body")[0].appendChild(loginForm);
loginForm.submit();
```

One-time login URLs support deep linking.

You can have multiple active sessions for a singular user as long each is session is created through unique login URLs. This is important you are using a single login such as [customerservice@partner.com](mailto:customerservice@partner.com) to access merchants' stores.

Reference: https://docs.bigcommerce.com/developer/docs/beta/powered-by/api-reference/stores/create-store-login-url

## Authentication

- `X-Auth-Client` header (required) — The client ID of the franchise API account.
- `X-Auth-Token` header (required) — An OAuth token generated from the franchise API account. To authenticate, generate an **OAuth Token** (if you donʼt have one or itʼs expired): ```http POST https://api.bigcommerce.com/franchises/{franchise_uuid}/v1/oauth/token Accept: application/json X-Auth-Client: {client_id} X-Auth-Secret: {client_secret} { "duration": 900 } ``` Response: ```json { "access_token": "dlkJcn34...Lkd012", "expires_at": "2018-04-24T16:15:26.509045122Z” } ``` After you generate an **OAuth token**, use the `client_id` and `oauth_token` to authenticate all other API requests: ```http GET https://api.bigcommerce.com/franchises/{franchise_uuid}/v1/accounts/123 Accept: application/json X-Auth-Client: {client_id} X-Auth-Token: {oauth_token} ``` Response: ```json { "data": { "id": "12345678910", "name": "Test Company", ... }, "meta": {} } ```

## Request

### Path parameters

- `store_id` (string, required) — The ID of the store.

### Headers

- `Accept` (string, required, default: application/json) — The [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of the response body.

### Body (application/json)

This endpoint expects an object.

- `user_email` (string, required) — Email address of the requested user. Email must belong to a user that belongs to the requesting account
- `redirect_path` (string, optional) — Note that you do not need `/manage/` for your URLs. You only need the path after `/manage/` that you would like the user directed to.

## Response

### 200

Success

- `data` (StoresStoreIdLoginUrlPostResponsesContentApplicationJsonSchemaData, required)
- `meta` (StoresStoreIdLoginUrlPostResponsesContentApplicationJsonSchemaMeta, required)

## Errors

### 400 Bad Request Error

Bad Request If the store is still provisioning or the request has malformed syntax, a 400 Bad Request is returned. Typically, you need to send the request once the store has completed provisioning or fix the JSON body and resend the request.

- `status` (double, required)
- `title` (string, required)
- `type` (string, required)

### 401 Unauthorized Error

Unauthorized If a franchise makes a request with a `client_id` and access token that do not belong together or are expired, a 401 Unauthorized Credentials response is returned.

- `status` (double, required)
- `title` (string, required)
- `type` (string, required)

### 403 Forbidden Error

Forbidden If an unauthorized franchise tries to make a request, the requested store is cancelled, an authorized franchise makes a request with a store that is not in their portfolio, or the requesting user makes a request for a store/account it does not have access to, a 403 Forbidden response is returned.

- `status` (double, required)
- `title` (string, required)
- `type` (string, required)

### 404 Not Found Error

Not Found If a store with the given `store_id` does not exist, you get a 404 Not Found.

- `status` (integer, optional) — The HTTP status code.
- `title` (string, optional) — The error title describing the particular error.
- `type` (string, optional)

### 502 Bad Gateway Error

Bad Gateway If something happens during the request that causes it to fail, a 502 response is returned. Submit a new get request. If it continues to fail, check the BigCommerce system status [here](http://status.bigcommerce.com/). A service is likely down and the request needs to be made again when the service is back up.

- `status` (double, required)
- `title` (string, required)
- `type` (string, required)

### 503 Service Unavailable Error

Service Unavailable If this occurs, you should retry the request. If you are unable to successfully make a request, please check the BigCommerce system status (here)[http://status.bigcommerce.com/]. A service is likely down and the request needs to be made again when the service is back up.

- `status` (integer, optional)
- `title` (string, optional)
- `type` (string, optional)
- `errors` (StoresStoreIdLoginUrlPostResponsesContentApplicationJsonSchemaErrors, optional)

### 504 Gateway Timeout Error

Gateway Timeout If this occurs, you should retry the request. Typically retrying the request several times will result in a successful request; However, if you are unable to successfully make a request, please check the BigCommerce system status [here](https://status.bigcommerce.com/). A service is likely down and the request will need to be made again when it is back up.

- `status` (integer, optional) — The HTTP status code.
- `title` (string, optional) — The error title describing the particular error.
- `type` (string, optional)
- `errors` (map from string to string, optional)

## Types

### StoresStoreIdLoginUrlPostResponsesContentApplicationJsonSchemaData

- `login-url` (string, required)

### StoresStoreIdLoginUrlPostResponsesContentApplicationJsonSchemaMeta

### StoresStoreIdLoginUrlPostResponsesContentApplicationJsonSchemaErrors

## Examples

**Request**

```json
{
  "user_email": "hello@example.com"
}
```

**Response**

```json
{
  "data": {
    "login-url": "https://login.bigcommerce.com/sso/express-logins/asdf1234/agdsa2214321rnfjdwjkflewrb318orewfij3wfcdn2/wpl8zqW95J0UafEaOySMvKVNA83%0AqVK5z1gUkXlEBSyFkOS7D7msDR8nYG0IECEtBDUhlGsKIVZWDZi0GVD6pg5+%0AbEEFvaMrhxbEgtaUUgoX1w==%0A"
  },
  "meta": {}
}
```

**SDK Code**

```python Example
import requests

url = "https://api.bigcommerce.com/franchises/franchise_uuid/v1/stores/store_id/login-url"

payload = { "user_email": "hello@example.com" }
headers = {
    "Accept": "application/json",
    "X-Auth-Client": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Example
const url = 'https://api.bigcommerce.com/franchises/franchise_uuid/v1/stores/store_id/login-url';
const options = {
  method: 'POST',
  headers: {
    Accept: 'application/json',
    'X-Auth-Client': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"user_email":"hello@example.com"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Example
package main

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

func main() {

	url := "https://api.bigcommerce.com/franchises/franchise_uuid/v1/stores/store_id/login-url"

	payload := strings.NewReader("{\n  \"user_email\": \"hello@example.com\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("X-Auth-Client", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

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

url = URI("https://api.bigcommerce.com/franchises/franchise_uuid/v1/stores/store_id/login-url")

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

request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/json'
request["X-Auth-Client"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"user_email\": \"hello@example.com\"\n}"

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

```java Example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.bigcommerce.com/franchises/franchise_uuid/v1/stores/store_id/login-url")
  .header("Accept", "application/json")
  .header("X-Auth-Client", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"user_email\": \"hello@example.com\"\n}")
  .asString();
```

```php Example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.bigcommerce.com/franchises/franchise_uuid/v1/stores/store_id/login-url', [
  'body' => '{
  "user_email": "hello@example.com"
}',
  'headers' => [
    'Accept' => 'application/json',
    'Content-Type' => 'application/json',
    'X-Auth-Client' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Example
using RestSharp;

var client = new RestClient("https://api.bigcommerce.com/franchises/franchise_uuid/v1/stores/store_id/login-url");
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/json");
request.AddHeader("X-Auth-Client", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"user_email\": \"hello@example.com\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Example
import Foundation

let headers = [
  "Accept": "application/json",
  "X-Auth-Client": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["user_email": "hello@example.com"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.bigcommerce.com/franchises/franchise_uuid/v1/stores/store_id/login-url")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```