Skip to content

Update a Sender ID

This guide explains how to update an existing Sender ID in HudumaSMS using the PUT method. A Sender ID is a unique alphanumeric identity that appears as the sender of your SMS messages.

Overview

Updating a Sender ID allows you to modify its properties to better suit your messaging needs. When updating a Sender ID, you can modify:

  • Name: The descriptive name for internal reference
  • Purpose: The type of messages (transactional, promotional, or notification)
  • Access: The visibility level (private or public)
  • Sample: The sample message demonstrating usage

API Endpoint

PUT /sender-ids

Request Parameters

ParameterTypeRequiredDescription
senderIdintegerYesThe ID of the Sender ID to update
namestringYesUpdated name for the Sender ID (1-11 characters)
purposestringYesUpdated purpose (TRANSACTIONAL, PROMOTIONAL, or NOTIFICATION)
accessstringYesUpdated access level (PRIVATE or PUBLIC)
samplestringYesUpdated sample message demonstrating intended usage

Sample Request

Using TypeScript

typescript
import axios from 'axios';

interface SenderIdUpdate {
  senderId: number;
  name: string;
  purpose: 'TRANSACTIONAL' | 'PROMOTIONAL' | 'NOTIFICATION';
  access: 'PRIVATE' | 'PUBLIC';
  sample: string;
}

async function updateSenderId(apiToken: string, senderIdData: SenderIdUpdate) {
  try {
    const response = await axios.put(
      `https://sms-api.huduma.cloud/api/v3/sender-ids`,
      {
        name: senderIdData.name,
        purpose: senderIdData.purpose,
        access: senderIdData.access,
        sample: senderIdData.sample
      },
      {
        headers: {
          'X-Huduma': `Bearer ${apiToken}`,
          'Content-Type': 'application/json'
        }
      }
    );
    
    return response.data;
  } catch (error) {
    console.error('Error updating sender ID:', error);
    throw error;
  }
}

// Example usage
const apiToken = 'your_api_token_here';
const updatedSenderId: SenderIdUpdate = {
  senderId: 123,
  name: 'MYCOMPANY',
  purpose: 'TRANSACTIONAL',
  access: 'PRIVATE',
  sample: 'Your verification code is 123456. Valid for 10 minutes.'
};

updateSenderId(apiToken, updatedSenderId)
  .then(response => {
    console.log('Sender ID updated successfully:', response);
  })
  .catch(error => {
    console.error('Failed to update sender ID:', error.response?.data || error.message);
  });

Response

A successful request returns HTTP status 200 (OK) with the updated Sender ID details:

json
{
  "status": "100 CONTINUE",
  "code": 0,
  "message": "Sender ID updated successfully",
  "timestamp": "2025-04-10T07:00:03.466Z",
  "reqId": "string",
  "path": "string",
  "data": {
    "id": 123,
    "name": "MYCOMPANY",
    "purpose": "TRANSACTIONAL",
    "sample": "Your verification code is 123456. Valid for 10 minutes.",
    "access": "PRIVATE",
    "addedBy": {
      "id": 0,
      "uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "firstName": "string",
      "lastName": "string",
      "gender": "string",
      "email": "string",
      "phone": "string",
      "address": "string"
    },
    "status": "PENDING",
    "deletedAt": null,
    "createdAt": "2025-04-10T07:00:03.466Z",
    "updatedAt": "2025-04-10T07:00:03.466Z"
  }
}

Sender ID Status

After updating, the Sender ID may enter PENDING status if the changes require approval. You'll receive a notification once the updated Sender ID is approved and ready for use.

Response Status Codes

200 - OK

Returned when the Sender ID is successfully updated.

400 - Bad Request

Returned when the request contains invalid parameters.

401 - Unauthorized

Returned when authentication fails or API token is invalid.

403 - Forbidden

Returned when you don't have permission to update the Sender ID.

404 - Not Found

Returned when the specified Sender ID doesn't exist.

422 - Unprocessable Entity

Returned when the request is well-formed but cannot be processed due to semantic errors.

500 - Internal Server Error

Returned when an unexpected error occurs on the server.

(The error response formats remain the same as in the original create documentation)

Best Practices

  1. Maintain consistency: Ensure updates align with your brand identity
  2. Update samples accurately: Reflect the actual message content in the sample
  3. Verify permissions: Ensure you have authority to modify the Sender ID
  4. Monitor status: Check the approval status after significant changes

This transformed version maintains the core structure and details from the original while adapting it to describe updating an existing Sender ID using the PUT method with the specified request body format.