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

# Create Session

POST https://api.poweriq.energy/v1/external/weight-scale/sessions
Content-Type: application/json

Reference: https://docs.weight-scale.poweriq.energy/weight-scale-external/create-session

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: WeightScaleExternal
  version: 1.0.0
paths:
  /v1/external/weight-scale/sessions:
    post:
      operationId: create-session
      summary: Create Session
      tags:
        - ''
      parameters:
        - name: X-API-Key
          in: header
          required: false
          schema:
            type: string
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: >-
                    #/components/schemas/V1ExternalWeightScaleSessionsPostResponsesContentApplicationJsonSchemaItems
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostV1ExternalWeight-scaleSessionsRequestUnauthorizedError
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostV1ExternalWeight-scaleSessionsRequestConflictError
      requestBody:
        content:
          application/json:
            schema:
              type: string
servers:
  - url: https://api.poweriq.energy
components:
  schemas:
    V1ExternalWeightScaleSessionsPostResponsesContentApplicationJsonSchemaItems:
      type: object
      properties:
        id:
          type: string
          format: uuid
        serial_no:
          type: integer
      required:
        - id
        - serial_no
      title: >-
        V1ExternalWeightScaleSessionsPostResponsesContentApplicationJsonSchemaItems
    PostV1ExternalWeight-scaleSessionsRequestUnauthorizedError:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
      required:
        - error
        - message
      title: PostV1ExternalWeight-scaleSessionsRequestUnauthorizedError
    PostV1ExternalWeight-scaleSessionsRequestConflictError:
      type: object
      properties:
        error:
          type: string
      required:
        - error
      title: PostV1ExternalWeight-scaleSessionsRequestConflictError

```

## SDK Code Examples

```python Create Session_example
import requests

url = "https://api.poweriq.energy/v1/external/weight-scale/sessions"

payload = "{
    \"party_id\": \"24f3e9e7-fe45-481c-a1fc-8cd265d1d91d\", //created party or existing one in powerIQ platform or use default as this
    \"vehicle_no\": \"TN123\",//string
    \"remark\": \"234\",//string
    \"crop\": \"AGRI\",//string
    \"lot_no\": \"123\",//string
    \"date\": \"2026-05-18\",//string in yyyy-mm-dd format
    \"device_id\": \"28acc364-235e-4b6f-8ed6-3f44f55fe479\", //default
    \"warehouse_id\": \"d91a375d-3f1b-47b4-bf4d-091d6b1f949c\", //default
    \"organization_id\": \"c2d09c46-361a-4eff-afe3-01ccdce22fc5\" //default
}"
headers = {
    "X-API-Key": "<key>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create Session_example
const url = 'https://api.poweriq.energy/v1/external/weight-scale/sessions';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<key>', 'Content-Type': 'application/json'},
  body: '"{\n    \"party_id\": \"24f3e9e7-fe45-481c-a1fc-8cd265d1d91d\", //created party or existing one in powerIQ platform or use default as this\n    \"vehicle_no\": \"TN123\",//string\n    \"remark\": \"234\",//string\n    \"crop\": \"AGRI\",//string\n    \"lot_no\": \"123\",//string\n    \"date\": \"2026-05-18\",//string in yyyy-mm-dd format\n    \"device_id\": \"28acc364-235e-4b6f-8ed6-3f44f55fe479\", //default\n    \"warehouse_id\": \"d91a375d-3f1b-47b4-bf4d-091d6b1f949c\", //default\n    \"organization_id\": \"c2d09c46-361a-4eff-afe3-01ccdce22fc5\" //default\n}"'
};

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

```go Create Session_example
package main

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

func main() {

	url := "https://api.poweriq.energy/v1/external/weight-scale/sessions"

	payload := strings.NewReader("\"{\\n    \\\"party_id\\\": \\\"24f3e9e7-fe45-481c-a1fc-8cd265d1d91d\\\", //created party or existing one in powerIQ platform or use default as this\\n    \\\"vehicle_no\\\": \\\"TN123\\\",//string\\n    \\\"remark\\\": \\\"234\\\",//string\\n    \\\"crop\\\": \\\"AGRI\\\",//string\\n    \\\"lot_no\\\": \\\"123\\\",//string\\n    \\\"date\\\": \\\"2026-05-18\\\",//string in yyyy-mm-dd format\\n    \\\"device_id\\\": \\\"28acc364-235e-4b6f-8ed6-3f44f55fe479\\\", //default\\n    \\\"warehouse_id\\\": \\\"d91a375d-3f1b-47b4-bf4d-091d6b1f949c\\\", //default\\n    \\\"organization_id\\\": \\\"c2d09c46-361a-4eff-afe3-01ccdce22fc5\\\" //default\\n}\"")

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

	req.Header.Add("X-API-Key", "<key>")
	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 Create Session_example
require 'uri'
require 'net/http'

url = URI("https://api.poweriq.energy/v1/external/weight-scale/sessions")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<key>'
request["Content-Type"] = 'application/json'
request.body = "\"{\\n    \\\"party_id\\\": \\\"24f3e9e7-fe45-481c-a1fc-8cd265d1d91d\\\", //created party or existing one in powerIQ platform or use default as this\\n    \\\"vehicle_no\\\": \\\"TN123\\\",//string\\n    \\\"remark\\\": \\\"234\\\",//string\\n    \\\"crop\\\": \\\"AGRI\\\",//string\\n    \\\"lot_no\\\": \\\"123\\\",//string\\n    \\\"date\\\": \\\"2026-05-18\\\",//string in yyyy-mm-dd format\\n    \\\"device_id\\\": \\\"28acc364-235e-4b6f-8ed6-3f44f55fe479\\\", //default\\n    \\\"warehouse_id\\\": \\\"d91a375d-3f1b-47b4-bf4d-091d6b1f949c\\\", //default\\n    \\\"organization_id\\\": \\\"c2d09c46-361a-4eff-afe3-01ccdce22fc5\\\" //default\\n}\""

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

```java Create Session_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.poweriq.energy/v1/external/weight-scale/sessions")
  .header("X-API-Key", "<key>")
  .header("Content-Type", "application/json")
  .body("\"{\\n    \\\"party_id\\\": \\\"24f3e9e7-fe45-481c-a1fc-8cd265d1d91d\\\", //created party or existing one in powerIQ platform or use default as this\\n    \\\"vehicle_no\\\": \\\"TN123\\\",//string\\n    \\\"remark\\\": \\\"234\\\",//string\\n    \\\"crop\\\": \\\"AGRI\\\",//string\\n    \\\"lot_no\\\": \\\"123\\\",//string\\n    \\\"date\\\": \\\"2026-05-18\\\",//string in yyyy-mm-dd format\\n    \\\"device_id\\\": \\\"28acc364-235e-4b6f-8ed6-3f44f55fe479\\\", //default\\n    \\\"warehouse_id\\\": \\\"d91a375d-3f1b-47b4-bf4d-091d6b1f949c\\\", //default\\n    \\\"organization_id\\\": \\\"c2d09c46-361a-4eff-afe3-01ccdce22fc5\\\" //default\\n}\"")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.poweriq.energy/v1/external/weight-scale/sessions', [
  'body' => '"{\\n    \\"party_id\\": \\"24f3e9e7-fe45-481c-a1fc-8cd265d1d91d\\", //created party or existing one in powerIQ platform or use default as this\\n    \\"vehicle_no\\": \\"TN123\\",//string\\n    \\"remark\\": \\"234\\",//string\\n    \\"crop\\": \\"AGRI\\",//string\\n    \\"lot_no\\": \\"123\\",//string\\n    \\"date\\": \\"2026-05-18\\",//string in yyyy-mm-dd format\\n    \\"device_id\\": \\"28acc364-235e-4b6f-8ed6-3f44f55fe479\\", //default\\n    \\"warehouse_id\\": \\"d91a375d-3f1b-47b4-bf4d-091d6b1f949c\\", //default\\n    \\"organization_id\\": \\"c2d09c46-361a-4eff-afe3-01ccdce22fc5\\" //default\\n}"',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<key>',
  ],
]);

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

```csharp Create Session_example
using RestSharp;

var client = new RestClient("https://api.poweriq.energy/v1/external/weight-scale/sessions");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<key>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "\"{\\n    \\\"party_id\\\": \\\"24f3e9e7-fe45-481c-a1fc-8cd265d1d91d\\\", //created party or existing one in powerIQ platform or use default as this\\n    \\\"vehicle_no\\\": \\\"TN123\\\",//string\\n    \\\"remark\\\": \\\"234\\\",//string\\n    \\\"crop\\\": \\\"AGRI\\\",//string\\n    \\\"lot_no\\\": \\\"123\\\",//string\\n    \\\"date\\\": \\\"2026-05-18\\\",//string in yyyy-mm-dd format\\n    \\\"device_id\\\": \\\"28acc364-235e-4b6f-8ed6-3f44f55fe479\\\", //default\\n    \\\"warehouse_id\\\": \\\"d91a375d-3f1b-47b4-bf4d-091d6b1f949c\\\", //default\\n    \\\"organization_id\\\": \\\"c2d09c46-361a-4eff-afe3-01ccdce22fc5\\\" //default\\n}\"", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create Session_example
import Foundation

let headers = [
  "X-API-Key": "<key>",
  "Content-Type": "application/json"
]
let parameters = "{
    \"party_id\": \"24f3e9e7-fe45-481c-a1fc-8cd265d1d91d\", //created party or existing one in powerIQ platform or use default as this
    \"vehicle_no\": \"TN123\",//string
    \"remark\": \"234\",//string
    \"crop\": \"AGRI\",//string
    \"lot_no\": \"123\",//string
    \"date\": \"2026-05-18\",//string in yyyy-mm-dd format
    \"device_id\": \"28acc364-235e-4b6f-8ed6-3f44f55fe479\", //default
    \"warehouse_id\": \"d91a375d-3f1b-47b4-bf4d-091d6b1f949c\", //default
    \"organization_id\": \"c2d09c46-361a-4eff-afe3-01ccdce22fc5\" //default
}" as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.poweriq.energy/v1/external/weight-scale/sessions")! 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()
```