> ## Documentation Index
> Fetch the complete documentation index at: https://docs.okasie.be/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Listing Status

> Update the current status of a listing

# Update Listing Status

Update the current status of a listing by external reference.

<Note>
  Requires the `write:listings` scope. Contact support to enable write access.
</Note>

## Path Parameters

<ParamField path="externalReference" type="string" required>
  Your unique reference for this listing
</ParamField>

## Request Body

<ParamField body="status" type="string" required>
  New status: `active`, `pending`, `sold`, or `draft`
</ParamField>

## Response

<ResponseField name="data.listingId" type="string">
  Okasie listing UUID
</ResponseField>

<ResponseField name="data.externalReference" type="string">
  Your provided reference
</ResponseField>

<ResponseField name="data.status" type="string">
  Updated status: `active`, `pending`, `sold`, or `draft`
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://www.okasie.be/api/external/v1/listings/MY-REF-001/status" \
    -H "Authorization: Bearer YOUR_API_SECRET" \
    -H "Content-Type: application/json" \
    -d '{"status": "pending"}'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    "https://www.okasie.be/api/external/v1/listings/MY-REF-001/status",
    {
      method: "POST",
      headers: {
        Authorization: `Bearer ${process.env.PARTNER_SECRET}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ status: "pending" }),
    }
  );

  const data = await response.json();
  console.log(data.data.status);
  ```

  ```python Python theme={null}
  import os
  import requests

  url = "https://www.okasie.be/api/external/v1/listings/MY-REF-001/status"
  headers = {
      "Authorization": f"Bearer {os.getenv('PARTNER_SECRET')}",
      "Content-Type": "application/json"
  }

  response = requests.post(url, json={"status": "pending"}, headers=headers)
  status = response.json()['data']['status']
  print(f"Listing status: {status}")
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "data": {
      "listingId": "0c52cae7-bcaa-4b37-be0d-1b78c92c5225",
      "externalReference": "MY-REF-001",
      "status": "pending"
    }
  }
  ```
</ResponseExample>

## Error Responses

| Status | Code                | Description                        |
| ------ | ------------------- | ---------------------------------- |
| 400    | `INVALID_REFERENCE` | External reference is required     |
| 400    | `INVALID_JSON`      | Request body must be valid JSON    |
| 400    | `INVALID_BODY`      | Request body must be an object     |
| 401    | `UNAUTHORIZED`      | Invalid or missing API key         |
| 403    | `PROFILE_FORBIDDEN` | No access to this listing          |
| 404    | `NOT_FOUND`         | Listing not found for this partner |
| 422    | `VALIDATION_FAILED` | Invalid or missing `status`        |

<Tip>
  Use this endpoint for lightweight status changes. Use DELETE when you only need to mark a listing as sold.
</Tip>
