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

# Update a topology record

PUT https://api.pensar.dev/topology/records/{recordId}
Content-Type: application/json

Only the fields sent change; `null` clears an optional field. `recordType` is required and must match the record. A change that leaves the record as it was creates no version.

Requires the `inventory:write` API key scope.

Reference: https://docs.pensar.dev/console/api/api-reference/topology/update-topology-record

## Authentication

- `Authorization` header (bearer token, required) — A workspace API key, sent as `Authorization: Bearer`.
- `x-api-key` header (required) — A workspace API key, sent as `x-api-key`.

## Request

### Path parameters

- `recordId` (string, required) — Topology record id, e.g. `cmp_8f2a1c0d33`.

### Body (application/json)

This endpoint expects an UpdateTopologyRecordRequest.

- `UpdateTopologyRecordRequest`
  - UpdateTopologyRecordRequest0
  - UpdateTopologyRecordRequest1
  - UpdateTopologyRecordRequest2
  - UpdateTopologyRecordRequest3
  - UpdateTopologyRecordRequest4

## Response

### 200

The record and its current version.

- `record` (TopologyRecord, required) — A record of the map. Beyond these fields it carries those of its `recordType`: `name`, `kind` and, depending on the type, `boundary`, `exposure`, `endpoints`, `tech`, `from`, `to`, `label`, `appliesTo`, `gaps`, `component`, `title`, `severity` and so on. References to other records are record ids.
- `version` (integer, required) — The version this write created.

## Errors

### 400 Bad Request Error

The request is invalid. `error` describes the problem.

- `error` (string, required) — What went wrong, naming the offending value when useful.
- `detail` (string, optional) — On the topology routes, a refused request names a stable `error` code (`insufficient_scope` or `unknown_reference`) and explains it here.

### 401 Unauthorized Error

The API key is missing or invalid.

- `error` (string, required) — What went wrong, naming the offending value when useful.
- `detail` (string, optional) — On the topology routes, a refused request names a stable `error` code (`insufficient_scope` or `unknown_reference`) and explains it here.

### 403 Forbidden Error

The credential lacks the required scope or is not allowed this action.

- `error` (string, required) — What went wrong, naming the offending value when useful.
- `detail` (string, optional) — On the topology routes, a refused request names a stable `error` code (`insufficient_scope` or `unknown_reference`) and explains it here.

### 404 Not Found Error

The resource does not exist in this workspace.

- `error` (string, required) — What went wrong, naming the offending value when useful.
- `detail` (string, optional) — On the topology routes, a refused request names a stable `error` code (`insufficient_scope` or `unknown_reference`) and explains it here.

### 409 Conflict Error

The request conflicts with the current state of the resource.

- `error` (string, required) — What went wrong, naming the offending value when useful.
- `detail` (string, optional) — On the topology routes, a refused request names a stable `error` code (`insufficient_scope` or `unknown_reference`) and explains it here.

### 422 Unprocessable Entity Error

The request is well formed but refers to something that does not exist or is excluded. `error` is a stable code and `detail` explains it.

- `error` (string, required) — What went wrong, naming the offending value when useful.
- `detail` (string, optional) — On the topology routes, a refused request names a stable `error` code (`insufficient_scope` or `unknown_reference`) and explains it here.

## Types

### UpdateTopologyRecordRequest0

- `recordType` (enum, required)
  - Allowed values: `boundary`
- `kind` (enum, optional)
  - Allowed values: `edge-network`, `cloud-account`, `region`, `vpc`, `subnet`, `third-party`, `user-device`
- `name` (string, optional) — Unique boundary name, e.g. 'AWS production account', 'Console VPC', 'Private subnets'.
- `provider` (string, optional, nullable)
- `description` (string, optional, nullable)
- `parent` (string, optional, nullable)
- `evidence` (list of UpdateTopologyRecordRequestOneOf0EvidenceItems, optional) — Why the change is true. Kept on the record as asserted evidence.

### UpdateTopologyRecordRequest1

- `recordType` (enum, required)
  - Allowed values: `component`
- `kind` (enum, optional)
  - Allowed values: `application`, `client`, `entrypoint`, `compute`, `database`, `cache`, `queue`, `object-store`, `message-broker`, `proxy`, `identity-provider`, `llm-provider`, `saas`
- `name` (string, optional) — Unique component name, e.g. 'Pensar Console (web)', 'Aurora PostgreSQL', 'api.example.com'.
- `tech` (string, optional, nullable)
- `exposure` (enum, optional, nullable) — public = reachable from the internet; private = only from inside its boundary.
  - Allowed values: `public`, `private`, `unknown`
- `endpoints` (list of string, optional, nullable)
- `repository` (string, optional, nullable)
- `description` (string, optional, nullable)
- `atStake` (string, optional, nullable)
- `trustAssumptions` (list of string, optional, nullable)
- `businessLogic` (string, optional, nullable)
- `members` (list of string, optional, nullable)
- `boundary` (string, optional, nullable)
- `usedBy` (list of string, optional, nullable)
- `evidence` (list of UpdateTopologyRecordRequestOneOf1EvidenceItems, optional) — Why the change is true. Kept on the record as asserted evidence.

### UpdateTopologyRecordRequest2

- `recordType` (enum, required)
  - Allowed values: `flow`
- `from` (string, optional) — Id of the component traffic originates from, e.g. from GET /topology.
- `to` (string, optional) — Id of the component it reaches, e.g. from GET /topology.
- `label` (string, optional) — Short protocol or purpose, e.g. 'HTTPS', 'RDS Proxy', 'enqueue jobs'.
- `evidence` (list of UpdateTopologyRecordRequestOneOf2EvidenceItems, optional) — Why the change is true. Kept on the record as asserted evidence.

### UpdateTopologyRecordRequest3

- `recordType` (enum, required)
  - Allowed values: `control`
- `kind` (enum, optional)
  - Allowed values: `waf`, `ip-allowlist`, `geo-block`, `security-group`, `network-isolation`, `origin-secret`, `authentication`, `authorization`, `tenant-isolation`, `rate-limit`, `encryption`, `secret-management`, `iam-policy`, `input-validation`, `logging`
- `name` (string, optional) — Unique control name, e.g. 'API WAF', 'Aurora security group', 'Workspace authorization in server actions'.
- `protects` (string, optional) — What it is meant to stop or guarantee, concretely.
- `appliesTo` (list of string, optional)
- `gaps` (string, optional, nullable)
- `evidence` (list of UpdateTopologyRecordRequestOneOf3EvidenceItems, optional) — Why the change is true. Kept on the record as asserted evidence.

### UpdateTopologyRecordRequest4

- `recordType` (enum, required)
  - Allowed values: `threat`
- `category` (enum, optional)
  - Allowed values: `spoofing`, `tampering`, `repudiation`, `information-disclosure`, `denial-of-service`, `elevation-of-privilege`
- `severity` (enum, optional) — How bad it is if it holds, from the impact: critical for cross-tenant data, account takeover, or code execution; high for one tenant's sensitive data or privileged actions; medium for limited data or abuse; low for minor disclosure.
  - Allowed values: `critical`, `high`, `medium`, `low`
- `component` (string, optional) — Id of the component the threat targets, e.g. from GET /topology.
- `title` (string, optional) — Short, specific title, unique within the component, e.g. 'Read any account through legacy v1 IDs'.
- `entryPoint` (string, optional) — Where the attack starts, concretely enough to send a request to: a host plus method and route, and the parameter, header, cookie, or field involved — e.g. 'POST https://app.example.com/api/v1/orders, body.accountId'. For a non-HTTP surface: the queue, bucket, function URL, or API call.
- `scenario` (string, optional) — Who does what, through which entry point and flow, exploiting which trust assumption or control gap, with what result — concrete to this system.
- `attackSteps` (list of string, optional) — The attack in order, one action per step, as a tester would carry it out: what to request or do, with which values, and what each step yields for the next.
- `impact` (string, optional) — What is lost and how widely: whose data, which privileges, how much money or availability.
- `preconditions` (list of string, optional, nullable)
- `likelihood` (enum, optional, nullable)
  - Allowed values: `low`, `medium`, `high`
- `likelihoodRationale` (string, optional, nullable)
- `verification` (string, optional, nullable)
- `controls` (list of string, optional, nullable)
- `evidence` (list of UpdateTopologyRecordRequestOneOf4EvidenceItems, optional) — Why the change is true. Kept on the record as asserted evidence.

### TopologyRecord

A record of the map. Beyond these fields it carries those of its `recordType`: `name`, `kind` and, depending on the type, `boundary`, `exposure`, `endpoints`, `tech`, `from`, `to`, `label`, `appliesTo`, `gaps`, `component`, `title`, `severity` and so on. References to other records are record ids.

- `id` (string, required)
- `recordType` (enum, required)
  - Allowed values: `boundary`, `component`, `flow`, `control`, `threat`
- `provenance` (enum, required) — Whether recon found it or a person told us.
  - Allowed values: `agent`, `asserted`
- `updatedAt` (datetime, required)
- `assertedBy` (TopologyAssertedBy, optional)
- `excluded` (boolean, optional)
- `excludedReason` (string, optional)
- `applicationId` (string, optional) — For a component, the application that tests it.

### UpdateTopologyRecordRequestOneOf0EvidenceItems

- `detail` (string, required) — What was asserted and why it can be trusted.
- `ref` (string, optional) — A file path, URL or ticket the claim comes from.

### UpdateTopologyRecordRequestOneOf1EvidenceItems

- `detail` (string, required) — What was asserted and why it can be trusted.
- `ref` (string, optional) — A file path, URL or ticket the claim comes from.

### UpdateTopologyRecordRequestOneOf2EvidenceItems

- `detail` (string, required) — What was asserted and why it can be trusted.
- `ref` (string, optional) — A file path, URL or ticket the claim comes from.

### UpdateTopologyRecordRequestOneOf3EvidenceItems

- `detail` (string, required) — What was asserted and why it can be trusted.
- `ref` (string, optional) — A file path, URL or ticket the claim comes from.

### UpdateTopologyRecordRequestOneOf4EvidenceItems

- `detail` (string, required) — What was asserted and why it can be trusted.
- `ref` (string, optional) — A file path, URL or ticket the claim comes from.

### TopologyAssertedBy

- `type` (enum, required)
  - Allowed values: `user`, `apiKey`
- `id` (string, required)
- `name` (string, required)
- `createdBy` (string, optional) — For an API key, the user who created it.

## Examples

**Request**

```json
{
  "recordType": "boundary"
}
```

**Response**

```json
{
  "record": {
    "id": "cmp_8f2a1c0d33",
    "recordType": "boundary",
    "provenance": "agent",
    "updatedAt": "2024-01-15T09:30:00Z",
    "assertedBy": {
      "type": "user",
      "id": "string",
      "name": "string",
      "createdBy": "string"
    },
    "excluded": true,
    "excludedReason": "string",
    "applicationId": "string"
  },
  "version": 1
}
```

**SDK Code**

```python
import requests

url = "https://api.pensar.dev/topology/records/recordId"

payload = { "recordType": "boundary" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.pensar.dev/topology/records/recordId';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"recordType":"boundary"}'
};

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://api.pensar.dev/topology/records/recordId"

	payload := strings.NewReader("{\n  \"recordType\": \"boundary\"\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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://api.pensar.dev/topology/records/recordId")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"recordType\": \"boundary\"\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://api.pensar.dev/topology/records/recordId")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"recordType\": \"boundary\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.pensar.dev/topology/records/recordId', [
  'body' => '{
  "recordType": "boundary"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.pensar.dev/topology/records/recordId");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"recordType\": \"boundary\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["recordType": "boundary"] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.pensar.dev/topology/records/recordId")! 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()
```