Skip to main content
PATCH
/
v2
/
contexts
/
{type}
/
{id}
PHP
declare(strict_types=1);

require 'vendor/autoload.php';

use novu;
use novu\Models\Components;

$sdk = novu\Novu::builder()
    ->setSecurity(
        'YOUR_SECRET_KEY_HERE'
    )
    ->build();

$updateContextRequestDto = new Components\UpdateContextRequestDto(
    data: [
        'tenantName' => 'Acme Corp',
        'region' => 'us-east-1',
        'settings' => [
            'theme' => 'dark',
        ],
    ],
);

$response = $sdk->contexts->update(
    id: '<id>',
    type: '<value>',
    updateContextRequestDto: $updateContextRequestDto

);

if ($response->getContextResponseDto !== null) {
    // handle response
}
{
  "type": "<string>",
  "id": "<string>",
  "data": {},
  "createdAt": "<string>",
  "updatedAt": "<string>"
}

Authorizations

Authorization
string
header
required

API key authentication. Allowed headers-- "Authorization: ApiKey <novu_secret_key>".

Headers

idempotency-key
string

A header for idempotency purposes

Path Parameters

id
string
required

Context ID

type
string
required

Context type

Body

application/json
data
object
required

Custom data to associate with this context. Replaces existing data.

Example:
{
"tenantName": "Acme Corp",
"region": "us-east-1",
"settings": { "theme": "dark" }
}

Response

OK

type
string
required

Context type (e.g., tenant, app, workspace)

id
string
required

Unique identifier for this context

data
object
required

Custom data associated with this context

createdAt
string
required

Creation timestamp

updatedAt
string
required

Last update timestamp