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

# Login

POST https://api.staple.io/v1/users/login
Content-Type: application/json

Login to the user account with your email and password

Reference: https://docs.staple.ai/api-reference/v1/users/login

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: v1
  version: 1.0.0
paths:
  /v1/users/login:
    post:
      operationId: login
      summary: Login
      description: Login to the user account with your email and password
      tags:
        - users
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Users_login_Response_200'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                credential:
                  $ref: >-
                    #/components/schemas/V1UsersLoginPostRequestBodyContentApplicationJsonSchemaCredential
servers:
  - url: https://api.staple.io
    description: https://api.staple.io
components:
  schemas:
    V1UsersLoginPostRequestBodyContentApplicationJsonSchemaCredential:
      type: object
      properties:
        email:
          type: string
        password:
          type: string
      title: V1UsersLoginPostRequestBodyContentApplicationJsonSchemaCredential
    Users_login_Response_200:
      type: object
      properties: {}
      description: Empty response body
      title: Users_login_Response_200

```

## Examples

### Login



**Request**

```json
undefined
```

**Response**

```json
{
  "login": {
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eywewQiOjQwLCJpZGVudGl0eSI6IjQwIiwiaWF0IjoxNTkzNzU5MzMxLCJleHAiOjE1OTM3OTUzMzF9.gHpPQJFY0bXi1lzptj5EBbU-yQSh3LqRgfBfLlgw22E",
    "apiKey": "affd15b30cadab9ff95230dc51e8646fa4aade5dee23e79ca3aae9018f7bed01",
    "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjQwLCJpYXQiOjE1OTM3NTkzMzEsImV4cCI6MTU5NDM2NDEzMX0.b"
  }
}
```

**SDK Code**

```python Login
import requests

url = "https://api.staple.io/v1/users/login"

headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript Login
const url = 'https://api.staple.io/v1/users/login';
const options = {method: 'POST', headers: {'Content-Type': 'application/json'}, body: undefined};

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

```go Login
package main

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

func main() {

	url := "https://api.staple.io/v1/users/login"

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

	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 Login
require 'uri'
require 'net/http'

url = URI("https://api.staple.io/v1/users/login")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'

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

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

HttpResponse<String> response = Unirest.post("https://api.staple.io/v1/users/login")
  .header("Content-Type", "application/json")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.staple.io/v1/users/login', [
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Login
using RestSharp;

var client = new RestClient("https://api.staple.io/v1/users/login");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Login
import Foundation

let headers = ["Content-Type": "application/json"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.staple.io/v1/users/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()
```

### Users_login_example



**Request**

```json
{
  "credential": {
    "email": "m",
    "password": "@24"
  }
}
```

**Response**

```json
{
  "login": {
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eywewQiOjQwLCJpZGVudGl0eSI6IjQwIiwiaWF0IjoxNTkzNzU5MzMxLCJleHAiOjE1OTM3OTUzMzF9.gHpPQJFY0bXi1lzptj5EBbU-yQSh3LqRgfBfLlgw22E",
    "apiKey": "affd15b30cadab9ff95230dc51e8646fa4aade5dee23e79ca3aae9018f7bed01",
    "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjQwLCJpYXQiOjE1OTM3NTkzMzEsImV4cCI6MTU5NDM2NDEzMX0.b"
  }
}
```

**SDK Code**

```python Users_login_example
import requests

url = "https://api.staple.io/v1/users/login"

payload = { "credential": {
        "email": "m",
        "password": "@24"
    } }
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript Users_login_example
const url = 'https://api.staple.io/v1/users/login';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"credential":{"email":"m","password":"@24"}}'
};

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

```go Users_login_example
package main

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

func main() {

	url := "https://api.staple.io/v1/users/login"

	payload := strings.NewReader("{\n  \"credential\": {\n    \"email\": \"m\",\n    \"password\": \"@24\"\n  }\n}")

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

	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 Users_login_example
require 'uri'
require 'net/http'

url = URI("https://api.staple.io/v1/users/login")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"credential\": {\n    \"email\": \"m\",\n    \"password\": \"@24\"\n  }\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.staple.io/v1/users/login")
  .header("Content-Type", "application/json")
  .body("{\n  \"credential\": {\n    \"email\": \"m\",\n    \"password\": \"@24\"\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.staple.io/v1/users/login', [
  'body' => '{
  "credential": {
    "email": "m",
    "password": "@24"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Users_login_example
using RestSharp;

var client = new RestClient("https://api.staple.io/v1/users/login");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"credential\": {\n    \"email\": \"m\",\n    \"password\": \"@24\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Users_login_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["credential": [
    "email": "m",
    "password": "@24"
  ]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.staple.io/v1/users/login")! 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()
```