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

# Issue site login link

POST https://api.modulards.com/api/public/v1/sites/{site}/login

Issues a single-use WordPress login link for the website's default WordPress user. The link is valid for 10 minutes; open `data.attributes.login_url` in a browser to sign in. A successful login is audited. Requires a token with the write ability.

Path variables:
- `site` (integer): the website id, e.g. `123`.

The returned URL points to a signed, browser-only redirect route and is not meant to be called directly from Postman.

Errors: 400 when the website is not connected, 400 when the website has no WordPress user synced, 403 for a read-only token, 404 when the caller has no permission for the website or it does not exist, 503 when Modular DS could not issue the link right now because its single-use token store is unavailable - retry in a moment.

Reference: https://api.docs.modulards.com/modular-ds-public-api/sites/issue-site-login-link

## Authentication

- `Authorization` header (bearer token, required) — Personal access token created in the Modular DS dashboard; read-only tokens can only call GET endpoints.

## Request

### Path parameters

- `site` (string, required)

## Response

### 200

200 - Login link issued

- `jsonapi` (object, optional)
  - `version` (string, optional)
- `meta` (object, optional)
  - `expires_at` (string, optional)
  - `login_url` (string, optional)

## Errors

### 403 Forbidden Error

403 Forbidden - Read-only token

- `errors` (list of object, optional)
  - `detail` (string, optional)
  - `status` (string, optional)
  - `title` (string, optional)
- `jsonapi` (object, optional)
  - `version` (string, optional)

### 404 Not Found Error

404 Not Found

- `errors` (list of object, optional)
  - `detail` (string, optional)
  - `status` (string, optional)
  - `title` (string, optional)
- `jsonapi` (object, optional)
  - `version` (string, optional)

## Examples

**Response**

```json
{
  "jsonapi": {
    "version": "1.1"
  },
  "meta": {
    "expires_at": "2026-09-17T10:10:00.000000Z",
    "login_url": "https://api.modulards.com/api/sites/123/login/redirect?expires=1789650000&nonce=FAKE_NONCE&origin=public_api&signature=FAKE_SIGNATURE&user=456"
  }
}
```

**SDK Code**

```python 200 - Login link issued
import requests

url = "https://api.modulards.com/api/public/v1/sites/site/login"

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript 200 - Login link issued
const url = 'https://api.modulards.com/api/public/v1/sites/site/login';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

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

```go 200 - Login link issued
package main

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

func main() {

	url := "https://api.modulards.com/api/public/v1/sites/site/login"

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

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

```ruby 200 - Login link issued
require 'uri'
require 'net/http'

url = URI("https://api.modulards.com/api/public/v1/sites/site/login")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

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

```java 200 - Login link issued
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.modulards.com/api/public/v1/sites/site/login")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php 200 - Login link issued
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.modulards.com/api/public/v1/sites/site/login', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp 200 - Login link issued
using RestSharp;

var client = new RestClient("https://api.modulards.com/api/public/v1/sites/site/login");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift 200 - Login link issued
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.modulards.com/api/public/v1/sites/site/login")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```