> This page is for Developer.

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

# Run an operation on an return

POST https://api.feedamp.feedonomics.com/api/v2/returns/{return-id}/run-operation
Content-Type: application/json

Run the operation specified in the request on an return. The contents of the request and response will vary depending on the operation.

Reference: https://docs.feedonomics.com/developer/api-reference/rest/feed-amp-order-api-v2/returns/run-return-op

## Authentication

- `token` header (required) — The Authentication token obtained from the get_token route.
- `x-api-key` header (required) — The SSO token obtained from the Feedonomics platform SSO token route.

## Request

### Path parameters

- `return-id` (string, required) — FeedAMP Return ID

### Query parameters

- `op` (string, required) — Name of the operation to run

### Headers

- `client` (integer, required) — The ID of the client making the request

### Body (application/json)

This endpoint expects a Returns_RunReturnOp_Request.

- `Returns_RunReturnOp_Request`
  - map from string to any
  - ReturnMiraklReturnCompliance: ReturnMiraklReturnCompliance

## Response

### 200

Operation Result

- `operation` (string, optional)
- `response` (OperationResultResponse, optional)

### 202

Operation was queued to run (cannot be run synchronously)

- `operation` (string, optional)
- `response` (OperationResultResponse, optional)

## Errors

### 400 Bad Request Error

Problem executing the requested operation

- `RunReturnOpRequestBadRequestError`
  - RunReturnOpRequestBadRequestError0
  - RunReturnOpRequestBadRequestError1

### 401 Unauthorized Error

Error validating credentials or access to resources.

- `error` (string, required)

### 404 Not Found Error

Requested return does not exist

- `any`

### 500 Internal Server Error

An unexpected server error occurred. Please contact Feedonomics Support if error persists.

- `error` (string, required)

### 502 Bad Gateway Error

Problem executing the requested operation

- `RunReturnOpRequestBadGatewayError`
  - RunReturnOpRequestBadGatewayError0
  - RunReturnOpRequestBadGatewayError1

### 503 Service Unavailable Error

Server is temporarily unable to handle the request

- `error` (string, required)

## Types

### ReturnMiraklReturnCompliance

Payload for Mirakl Mark Return as non-/Compliant

- `lines` (list of ReturnMiraklReturnComplianceLinesItems, required)

### OperationResultResponse

### RunReturnOpRequestBadRequestError0

- `operation` (string, optional)
- `response` (string, optional)

### RunReturnOpRequestBadRequestError1

- `error` (string, required)

### RunReturnOpRequestBadGatewayError0

- `operation` (string, optional)
- `response` (string, optional)

### RunReturnOpRequestBadGatewayError1

- `error` (string, required)

### ReturnMiraklReturnComplianceLinesItems

- ReturnMiraklReturnComplianceLinesItems0
- ReturnMiraklReturnComplianceLinesItems1

### ReturnMiraklReturnComplianceLinesItems0

Mark a Mirakl return line as compliant

- `id` (string, required) — the return line id

### ReturnMiraklReturnComplianceLinesItems1

Mark a Mirakl return line as non-compliant

- `id` (string, required) — the return line id
- `additional_info` (string, required) — Additional info as to why the line is not compliant
- `code` (enum, required) — Mirakl Reason Code
  - Allowed values: `RETURN_NON_COMPLIANT_MISSING_ITEM`, `RETURN_NON_COMPLIANT_WRONG_PRODUCT`, `RETURN_NON_COMPLIANT_DAMAGED_PRODUCT`, `RETURN_NON_COMPLIANT_WINDOW_CLOSED`, `RETURN_NON_COMPLIANT_OTHER`

## Examples

### mirakl_compliance

**Request**

```json
{
  "lines": [
    {
      "id": "RETURN-LINE-1"
    },
    {
      "additional_info": "INFO",
      "code": "RETURN_NON_COMPLIANT_MISSING_ITEM",
      "id": "RETURN_LINE-2"
    }
  ]
}
```

**Response**

```json
{
  "operation": "string",
  "response": {}
}
```

**SDK Code**

```python mirakl_compliance
import requests

url = "https://api.feedamp.feedonomics.com/api/v2/returns/109872189273617283/run-operation"

querystring = {"op":"process"}

payload = { "lines": [
        { "id": "RETURN-LINE-1" },
        {
            "additional_info": "INFO",
            "code": "RETURN_NON_COMPLIANT_MISSING_ITEM",
            "id": "RETURN_LINE-2"
        }
    ] }
headers = {
    "client": "1",
    "token": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript mirakl_compliance
const url = 'https://api.feedamp.feedonomics.com/api/v2/returns/109872189273617283/run-operation?op=process';
const options = {
  method: 'POST',
  headers: {client: '1', token: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"lines":[{"id":"RETURN-LINE-1"},{"additional_info":"INFO","code":"RETURN_NON_COMPLIANT_MISSING_ITEM","id":"RETURN_LINE-2"}]}'
};

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

```go mirakl_compliance
package main

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

func main() {

	url := "https://api.feedamp.feedonomics.com/api/v2/returns/109872189273617283/run-operation?op=process"

	payload := strings.NewReader("{\n  \"lines\": [\n    {\n      \"id\": \"RETURN-LINE-1\"\n    },\n    {\n      \"additional_info\": \"INFO\",\n      \"code\": \"RETURN_NON_COMPLIANT_MISSING_ITEM\",\n      \"id\": \"RETURN_LINE-2\"\n    }\n  ]\n}")

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

	req.Header.Add("client", "1")
	req.Header.Add("token", "<apiKey>")
	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 mirakl_compliance
require 'uri'
require 'net/http'

url = URI("https://api.feedamp.feedonomics.com/api/v2/returns/109872189273617283/run-operation?op=process")

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

request = Net::HTTP::Post.new(url)
request["client"] = '1'
request["token"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"lines\": [\n    {\n      \"id\": \"RETURN-LINE-1\"\n    },\n    {\n      \"additional_info\": \"INFO\",\n      \"code\": \"RETURN_NON_COMPLIANT_MISSING_ITEM\",\n      \"id\": \"RETURN_LINE-2\"\n    }\n  ]\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.feedamp.feedonomics.com/api/v2/returns/109872189273617283/run-operation?op=process")
  .header("client", "1")
  .header("token", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"lines\": [\n    {\n      \"id\": \"RETURN-LINE-1\"\n    },\n    {\n      \"additional_info\": \"INFO\",\n      \"code\": \"RETURN_NON_COMPLIANT_MISSING_ITEM\",\n      \"id\": \"RETURN_LINE-2\"\n    }\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.feedamp.feedonomics.com/api/v2/returns/109872189273617283/run-operation?op=process', [
  'body' => '{
  "lines": [
    {
      "id": "RETURN-LINE-1"
    },
    {
      "additional_info": "INFO",
      "code": "RETURN_NON_COMPLIANT_MISSING_ITEM",
      "id": "RETURN_LINE-2"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'client' => '1',
    'token' => '<apiKey>',
  ],
]);

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

```csharp mirakl_compliance
using RestSharp;

var client = new RestClient("https://api.feedamp.feedonomics.com/api/v2/returns/109872189273617283/run-operation?op=process");
var request = new RestRequest(Method.POST);
request.AddHeader("client", "1");
request.AddHeader("token", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"lines\": [\n    {\n      \"id\": \"RETURN-LINE-1\"\n    },\n    {\n      \"additional_info\": \"INFO\",\n      \"code\": \"RETURN_NON_COMPLIANT_MISSING_ITEM\",\n      \"id\": \"RETURN_LINE-2\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift mirakl_compliance
import Foundation

let headers = [
  "client": "1",
  "token": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["lines": [
    ["id": "RETURN-LINE-1"],
    [
      "additional_info": "INFO",
      "code": "RETURN_NON_COMPLIANT_MISSING_ITEM",
      "id": "RETURN_LINE-2"
    ]
  ]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.feedamp.feedonomics.com/api/v2/returns/109872189273617283/run-operation?op=process")! 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()
```

### mirakl_compliance

**Request**

```json
{
  "lines": [
    {
      "id": "RETURN-LINE-1"
    },
    {
      "additional_info": "INFO",
      "code": "RETURN_NON_COMPLIANT_MISSING_ITEM",
      "id": "RETURN_LINE-2"
    }
  ]
}
```

**Response**

```json
{
  "operation": "string",
  "response": {}
}
```

**SDK Code**

```python mirakl_compliance
import requests

url = "https://api.feedamp.feedonomics.com/api/v2/returns/109872189273617283/run-operation"

querystring = {"op":"process"}

payload = { "lines": [
        { "id": "RETURN-LINE-1" },
        {
            "additional_info": "INFO",
            "code": "RETURN_NON_COMPLIANT_MISSING_ITEM",
            "id": "RETURN_LINE-2"
        }
    ] }
headers = {
    "client": "1",
    "token": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript mirakl_compliance
const url = 'https://api.feedamp.feedonomics.com/api/v2/returns/109872189273617283/run-operation?op=process';
const options = {
  method: 'POST',
  headers: {client: '1', token: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"lines":[{"id":"RETURN-LINE-1"},{"additional_info":"INFO","code":"RETURN_NON_COMPLIANT_MISSING_ITEM","id":"RETURN_LINE-2"}]}'
};

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

```go mirakl_compliance
package main

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

func main() {

	url := "https://api.feedamp.feedonomics.com/api/v2/returns/109872189273617283/run-operation?op=process"

	payload := strings.NewReader("{\n  \"lines\": [\n    {\n      \"id\": \"RETURN-LINE-1\"\n    },\n    {\n      \"additional_info\": \"INFO\",\n      \"code\": \"RETURN_NON_COMPLIANT_MISSING_ITEM\",\n      \"id\": \"RETURN_LINE-2\"\n    }\n  ]\n}")

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

	req.Header.Add("client", "1")
	req.Header.Add("token", "<apiKey>")
	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 mirakl_compliance
require 'uri'
require 'net/http'

url = URI("https://api.feedamp.feedonomics.com/api/v2/returns/109872189273617283/run-operation?op=process")

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

request = Net::HTTP::Post.new(url)
request["client"] = '1'
request["token"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"lines\": [\n    {\n      \"id\": \"RETURN-LINE-1\"\n    },\n    {\n      \"additional_info\": \"INFO\",\n      \"code\": \"RETURN_NON_COMPLIANT_MISSING_ITEM\",\n      \"id\": \"RETURN_LINE-2\"\n    }\n  ]\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.feedamp.feedonomics.com/api/v2/returns/109872189273617283/run-operation?op=process")
  .header("client", "1")
  .header("token", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"lines\": [\n    {\n      \"id\": \"RETURN-LINE-1\"\n    },\n    {\n      \"additional_info\": \"INFO\",\n      \"code\": \"RETURN_NON_COMPLIANT_MISSING_ITEM\",\n      \"id\": \"RETURN_LINE-2\"\n    }\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.feedamp.feedonomics.com/api/v2/returns/109872189273617283/run-operation?op=process', [
  'body' => '{
  "lines": [
    {
      "id": "RETURN-LINE-1"
    },
    {
      "additional_info": "INFO",
      "code": "RETURN_NON_COMPLIANT_MISSING_ITEM",
      "id": "RETURN_LINE-2"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'client' => '1',
    'token' => '<apiKey>',
  ],
]);

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

```csharp mirakl_compliance
using RestSharp;

var client = new RestClient("https://api.feedamp.feedonomics.com/api/v2/returns/109872189273617283/run-operation?op=process");
var request = new RestRequest(Method.POST);
request.AddHeader("client", "1");
request.AddHeader("token", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"lines\": [\n    {\n      \"id\": \"RETURN-LINE-1\"\n    },\n    {\n      \"additional_info\": \"INFO\",\n      \"code\": \"RETURN_NON_COMPLIANT_MISSING_ITEM\",\n      \"id\": \"RETURN_LINE-2\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift mirakl_compliance
import Foundation

let headers = [
  "client": "1",
  "token": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["lines": [
    ["id": "RETURN-LINE-1"],
    [
      "additional_info": "INFO",
      "code": "RETURN_NON_COMPLIANT_MISSING_ITEM",
      "id": "RETURN_LINE-2"
    ]
  ]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.feedamp.feedonomics.com/api/v2/returns/109872189273617283/run-operation?op=process")! 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()
```