# Assign Shipment

Assigning a shipment indicates to the SHiiP operations team that you are ready for pickup. This action triggers a queue on our end, prompting the team to begin processing your request. The operations team will then reach out promptly to coordinate and address any further questions or details.

## Payload

List of payload to assign a shipment.

<table><thead><tr><th width="140">Field</th><th width="87">Type</th><th width="104">Required</th><th>Validation Rules</th><th>Description</th></tr></thead><tbody><tr><td>shipment_id</td><td>Integer</td><td>Yes</td><td>Must be an ID of a shipment</td><td>An ID of the shipment being assigned ready for shipping</td></tr></tbody></table>

## Request Sample

{% tabs %}
{% tab title="Curl" %}

```javascript
curl --location 'https://delivery-staging.apiideraos.com/api/v2/token/shipment/assign' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer Secret Key' \
--data '{
    "shipment_id" : 21712
}'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

url = "https://delivery-staging.apiideraos.com/api/v2/token/shipment/assign"

payload = json.dumps({
  "shipment_id": 21712
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer Secret Key'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require "uri"
require "json"
require "net/http"

url = URI("https://delivery-staging.apiideraos.com/api/v2/token/shipment/assign")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer Secret Key"
request.body = JSON.dump({
  "shipment_id": 21712
})

response = https.request(request)
puts response.read_body

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://delivery-staging.apiideraos.com/api/v2/token/shipment/assign',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "shipment_id" : 21712
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Bearer Secret Key'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Javascript" %}

```javascript
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer Secret Key");

const raw = JSON.stringify({
  "shipment_id": 21712
});

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: raw,
  redirect: "follow"
};

fetch("https://delivery-staging.apiideraos.com/api/v2/token/shipment/assign", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

{% endtab %}

{% tab title="Golang" %}

```go
package main

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

func main() {

  url := "https://delivery-staging.apiideraos.com/api/v2/token/shipment/assign"
  method := "POST"

  payload := strings.NewReader(`{
    "shipment_id" : 21712
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("Authorization", "Bearer Secret Key")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}
{% endtabs %}

## Response Sample

{% tabs %}
{% tab title="422" %}

```json
{
    "status": false,
    "message": "The shipment id field is required."
}
```

{% endtab %}

{% tab title="200" %}

```json
{
    "data": null,
    "status": true,
    "message": "Shipment Assigned to ready for shipping Successfully.",
    "status_code": 200
}
```

{% endtab %}

{% tab title="404" %}

```json
{
    "data": null,
    "status": false,
    "message": "Shipment not found",
    "status_code": 404
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.goshiip.com/api-references/assign-shipment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
