Destructive Action

POST /message-invalidate

Invalidate a previously sent message, preventing it from being read or signed.

Endpoint

API Endpoint
POST https://msg.api.uip.id/v1/invalidate

Headers

Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Request Parameters

ParameterTypeRequiredDescription
message_idstringYesThe unique ID of the message to invalidate
reasonstringNoOptional reason for invalidation (for audit purposes)

Request Example

{
  "message_id": "msg_1234567890abcdef",
  "reason": "Contract terms updated - resending new version"
}

Response

{
  "status": "invalidated",
  "message_id": "msg_1234567890abcdef",
  "invalidated_at": "2024-01-15T10:30:00Z",
  "reason": "Contract terms updated - resending new version"
}

Important

Once invalidated, a message cannot be read or signed. The recipient will see that the message was invalidated. This action cannot be undone.

Code Implementation

// JavaScript
async function invalidateMessage(messageId, reason) {
  const response = await fetch('https://msg.api.uip.id/v1/invalidate', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer ' + YOUR_API_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      message_id: messageId,
      reason: reason
    })
  });

  if (!response.ok) {
    if (response.status === 404) {
      throw new Error('Message not found');
    }
    if (response.status === 400) {
      throw new Error('Message already signed or invalidated');
    }
    throw new Error('HTTP error! status: ' + response.status);
  }

  const data = await response.json();
  return data;
}

// Usage
const result = await invalidateMessage(
  'msg_1234567890abcdef',
  'Contract terms updated - resending new version'
);

console.log('Message invalidated at:', result.invalidated_at);

Common Use Cases

1 Cancel Accidental Messages

Immediately invalidate messages sent to the wrong recipient or with incorrect information before they can be read or signed.

2 Revoke Pending Signatures

Stop signature workflows when contracts or agreements need to be updated or corrected before signing.

3 Update Outdated Information

Invalidate messages containing outdated terms, pricing, or policy information and resend with current details.