This API is currently in closed beta and not publicly available

Delete Transaction

DELETE /v1/transactions/{transaction_id}

Description

Removes a transaction record from the system. This operation cannot be undone.

Path Parameters

ParameterTypeDescriptionRequired
transaction_idstringUnique identifier for the transactionYes

Example Request

Using curl

curl -X DELETE "https://api.onetribe.com/v1/transactions/tx-789xyz" \
  -H "Authorisation: API-Key YOUR_API_KEY_HERE"

Using TypeScript

class TransactionError extends Error {
  constructor(
    message: string,
    public status: number,
    public code: string,
  ) {
    super(message)
    this.name = 'TransactionError'
  }
}

async function deleteTransaction(transactionId: string): Promise<void> {
  const response = await fetch(
    `https://api.onetribe.com/v1/transactions/${transactionId}`,
    {
      method: 'DELETE',
      headers: {
        Authorisation: 'API-Key YOUR_API_KEY_HERE',
      },
    },
  )

  if (!response.ok) {
    switch (response.status) {
      case 404:
        throw new TransactionError('Transaction not found', 404, 'NotFound')
      case 401:
        throw new TransactionError('Invalid API key', 401, 'Unauthorized')
      case 403:
        throw new TransactionError(
          'Insufficient permissions to delete transaction',
          403,
          'Forbidden',
        )
      case 429:
        throw new TransactionError(
          'Rate limit exceeded',
          429,
          'TooManyRequests',
        )
      default:
        throw new TransactionError(
          'An error occurred while deleting the transaction',
          response.status,
          'ServerError',
        )
    }
  }
}

// Example usage
try {
  await deleteTransaction('tx-789xyz')
  console.log('Transaction deleted successfully')
} catch (error) {
  if (error instanceof TransactionError) {
    switch (error.code) {
      case 'NotFound':
        console.error('Transaction does not exist')
        break
      case 'Forbidden':
        console.error('You do not have permission to delete this transaction')
        break
      default:
        console.error(`${error.code} (${error.status}): ${error.message}`)
    }
  } else {
    console.error('Unexpected error:', error)
  }
}

Response

A successful deletion returns a 204 No Content response with no body.

Error Responses

Status CodeError CodeDescription
401UnauthorizedMissing or invalid API key
403ForbiddenInsufficient permissions to delete transaction
404NotFoundTransaction with the specified ID does not exist
429TooManyRequestsRate limit exceeded
500ServerErrorInternal server error