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

# Create or replace customer AP portal mapping

PUT https://integrators.prod.api.tabsplatform.com/v16/customers/{customerId}/ap-portal
Content-Type: application/json

Writes the customer's AP portal mapping, creating it if there isn't one. This is a full replacement, so any field you omit is cleared and an omitted `status` resets to PENDING — send the whole mapping every time. `portalName` is required when `portal` is OTHER and ignored for every other portal.

Reference: https://docs.tabs.com/api-reference/ap-portal/integrators-api-ap-portal-accounts-controller-replace-ap-portal-account

## Authentication

- `Authorization` header (required)

## Request

### Path parameters

- `customerId` (string, required) — Customer ID

### Body (application/json)

- `portal` (enum, required) — AP portal invoices to this customer are submitted through
  - Allowed values: `COUPA`, `ARIBA`, `TUNGSTEN`, `TAULIA`, `OTHER`
- `portalName` (string, optional) — Free-text portal name. Required when portal is OTHER, ignored otherwise.
- `instanceUrl` (string, optional) — Portal tenant URL. Omit to clear it.
- `supplierId` (string, optional) — Your supplier/vendor ID within this portal. Omit to clear it.
- `status` (enum, optional) — Lifecycle of the mapping. Omit to reset it to PENDING.
  - Allowed values: `PENDING`, `ACTIVE`, `INACTIVE`, `NEEDS_ATTENTION`

## Response

### 200

The stored AP portal mapping

- `payload` (object, required) — Response payload, will be empty when success is false
  - `id` (string, required) — Unique identifier of the AP portal mapping
  - `customerId` (string, required) — Customer this mapping belongs to
  - `portal` (enum, required) — AP portal invoices to this customer are submitted through
    - Allowed values: `COUPA`, `ARIBA`, `TUNGSTEN`, `TAULIA`, `OTHER`
  - `portalName` (string, required, nullable) — Free-text portal name. Set only when portal is OTHER, null otherwise.
  - `instanceUrl` (string, required, nullable) — Portal tenant URL
  - `supplierId` (string, required, nullable) — Your supplier/vendor ID within this portal
  - `status` (enum, required) — Lifecycle of the mapping
    - Allowed values: `PENDING`, `ACTIVE`, `INACTIVE`, `NEEDS_ATTENTION`
  - `createdAt` (datetime, required) — When the mapping was created
  - `updatedAt` (datetime, required) — When the mapping was last updated
- `success` (boolean, required) — Boolean with true=success, false=failure
- `message` (string, required) — Plain-text description of the result
- `error` (object, optional) — json element with any error messages or warnings
  - `code` (double, required) — API response code
  - `message` (string, required) — API response message
  - `details` (object, optional) — Additional details about the error

## Examples

**Request**

```json
{
  "portal": "COUPA"
}
```

**Response**

```json
{
  "payload": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "customerId": "123e4567-e89b-12d3-a456-426614174000",
    "portal": "COUPA",
    "portalName": "Acme AP Hub",
    "instanceUrl": "acme.coupahost.com",
    "supplierId": "SUP-10482",
    "status": "PENDING",
    "createdAt": "2023-01-01T00:00:00.000Z",
    "updatedAt": "2023-01-01T00:00:00.000Z"
  },
  "success": true,
  "message": "string",
  "error": {
    "code": 1.1,
    "message": "string",
    "details": {}
  }
}
```

**SDK Code**

```python
import requests

url = "https://integrators.prod.api.tabsplatform.com/v16/customers/123e4567-e89b-12d3-a456-426614174000/ap-portal"

payload = { "portal": "COUPA" }
headers = {
    "Authorization": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://integrators.prod.api.tabsplatform.com/v16/customers/123e4567-e89b-12d3-a456-426614174000/ap-portal';
const options = {
  method: 'PUT',
  headers: {Authorization: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"portal":"COUPA"}'
};

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

```go
package main

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

func main() {

	url := "https://integrators.prod.api.tabsplatform.com/v16/customers/123e4567-e89b-12d3-a456-426614174000/ap-portal"

	payload := strings.NewReader("{\n  \"portal\": \"COUPA\"\n}")

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

	req.Header.Add("Authorization", "<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
require 'uri'
require 'net/http'

url = URI("https://integrators.prod.api.tabsplatform.com/v16/customers/123e4567-e89b-12d3-a456-426614174000/ap-portal")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"portal\": \"COUPA\"\n}"

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

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

HttpResponse<String> response = Unirest.put("https://integrators.prod.api.tabsplatform.com/v16/customers/123e4567-e89b-12d3-a456-426614174000/ap-portal")
  .header("Authorization", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"portal\": \"COUPA\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://integrators.prod.api.tabsplatform.com/v16/customers/123e4567-e89b-12d3-a456-426614174000/ap-portal', [
  'body' => '{
  "portal": "COUPA"
}',
  'headers' => [
    'Authorization' => '<apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://integrators.prod.api.tabsplatform.com/v16/customers/123e4567-e89b-12d3-a456-426614174000/ap-portal");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"portal\": \"COUPA\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["portal": "COUPA"] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://integrators.prod.api.tabsplatform.com/v16/customers/123e4567-e89b-12d3-a456-426614174000/ap-portal")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```