DonutworkHelp Center
Documentazione Donutwork

Metadati utente IDP

Crea e sostituisci metadati JSON applicativi sulle identità Sentinel isolate per company.

Metadati utente IDP

Ogni identità Sentinel può contenere un oggetto JSON gestito dall'applicazione. I metadati sono restituiti dal profilo utente completo e dopo una verifica magic link riuscita, ma non assegnano mai ruoli backoffice o permessi API Donutwork.

Tutte le operazioni richiedono una API key bearer con permesso idp:write e restano isolate sulla company associata.

Fornisci i metadati durante il provisioning

Aggiungi l'oggetto facoltativo metadata alla normale richiesta di provisioning:

{
  "user": {
    "external_id": "ORG_USR_9921_AFG",
    "metadata": {
      "plan": "enterprise",
      "region": "eu",
      "features": ["sso", "audit"]
    }
  }
}

Sostituisci i metadati

PUT
/2026-02-01/idp/{externalUserId}/metadata.json
Required permissionidp:write

Path, query, and header parameters

externalUserIdstring· pathRequired
L'external_id fornito al provisioning.

Request Body

JSON
{
  "user": {
    "metadata": {
      "plan": "enterprise",
      "region": "eu",
      "features": [
        "sso",
        "audit"
      ]
    }
  }
}
user.metadataobjectRequired
Oggetto sostitutivo completo. Invia un oggetto vuoto per cancellare i metadati.

Responses

Metadati sostituiti.

{
  "user": {
    "id": "6908...",
    "external_id": "ORG_USR_9921_AFG",
    "metadata": {
      "plan": "enterprise",
      "region": "eu",
      "features": [
        "sso",
        "audit"
      ]
    }
  }
}

L'identità non esiste nella company autenticata.

I metadati non sono un oggetto valido o superano un limite strutturale.

Request examples

curl --request PUT 'https://api.hub.donutwork.com/2026-02-01/idp/EXTERNALUSERID/metadata.json' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "user": {
    "metadata": {
      "plan": "enterprise",
      "region": "eu",
      "features": [
        "sso",
        "audit"
      ]
    }
  }
}'
const response = await fetch('https://api.hub.donutwork.com/2026-02-01/idp/EXTERNALUSERID/metadata.json', {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer ' + process.env.DONUTWORK_API_KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "user": {
      "metadata": {
        "plan": "enterprise",
        "region": "eu",
        "features": [
          "sso",
          "audit"
        ]
      }
    }
  }),
});
const requestId = response.headers.get('x-request-id');
if (!response.ok) {
  const error = await response.text();
  throw new Error(`${response.status} ${error} [${requestId}]`);
}
const contentType = response.headers.get('content-type') ?? '';
const data = response.status === 204 ? null
  : contentType.includes('application/json') ? await response.json()
  : await response.text();
$request = curl_init('https://api.hub.donutwork.com/2026-02-01/idp/EXTERNALUSERID/metadata.json');
curl_setopt_array($request, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('DONUTWORK_API_KEY'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => '{
  "user": {
    "metadata": {
      "plan": "enterprise",
      "region": "eu",
      "features": [
        "sso",
        "audit"
      ]
    }
  }
}',
]);
$response = curl_exec($request);
if ($response === false) {
    $error = curl_error($request);
    curl_close($request);
    throw new RuntimeException($error);
}
$status = curl_getinfo($request, CURLINFO_RESPONSE_CODE);
$contentType = (string) curl_getinfo($request, CURLINFO_CONTENT_TYPE);
curl_close($request);
if ($status >= 400) { throw new RuntimeException($response); }
$data = $status === 204 ? null
    : (str_contains($contentType, 'application/json')
        ? json_decode($response, true, flags: JSON_THROW_ON_ERROR) : $response);

Replace uppercase placeholders and sample values with your own data and company resource IDs. Keep the API key on a trusted server. Reuse an idempotency key only for the same logical request and payload.

L'endpoint sostituisce l'intero oggetto e non esegue un merge dei campi. Il limite è 32 KB, 6 livelli annidati e 500 elementi. Le chiavi devono avere 1–128 caratteri, non possono contenere . né iniziare con $. I valori devono essere compatibili con JSON.

Il logger della Public API oscura l'intero campo metadata nei contenuti di richiesta e risposta.

On this page