Register a Provider

This route is restricted to Admin and Super Admin access only.

Create New Provider

This endpoint allows an administrator to register a new provider on the platform. Upon successful creation, the system generates a unique Provider ID and Provider API Key, and sends a welcome email containing these credentials to the provider's registered email address.

Endpoint

POST /api/v1/admin/providers

Authentication

TypeRequiredLocationDescription
Admin KeytrueHeaderThe key must be sent as x-api-key: ADMIN_KEY.

This is a protected administrative endpoint. You must provide the master ADMIN_KEY to successfully authenticate the request.


Request Body

The body of the request must be a JSON object containing the new provider's details.

FieldTypeRequiredDescription
namestringtrueThe provider's company or individual name.
emailstringtrueThe provider's contact email. Must be unique across the platform.
phonestringtrueThe provider's contact phone number. Must be unique across the platform.
instance_limitintegerfalseThe maximum number of instances this provider can list. Defaults to 10 if not provided.
retention_monthintegerfalseThe number of months an instance is kept before auto-deletion. Defaults to 6 if not provided.

Example Request

Here is an example of how to create a new provider using cURL. Replace YOUR_ADMIN_KEY.

curl -X POST 'https://offers.dataoorts.com/api/v1/admin/providers' \
-H 'Content-Type: application/json' \
-H 'x-api-key: YOUR_ADMIN_KEY' \
-d '{
    "name": "Ceres Providers",
    "email": "[email protected]",
    "phone": "+1-555-867-4309",
    "instance_limit": 10,
    "retention_month": 6
}'

Responses

✅ Success Response (201 Created)

Returned when the provider is successfully created and their details are saved to the database.

Body

The response includes the unique provider_id for the newly created provider.

{
  "status": "Provider created successfully",
  "provider_id": "PRO_21057596298742782"
}
📘

All provider credentials are sent to the provider’s registered email.


❌ Error Response (400 Bad Request)

Returned for various validation errors in the request body.

Body (Example: Duplicate Email)

This is returned if the email or phone number already exists in the system.

{
  "error": "Bad Request: Invalid data provided",
  "details": [
    "Provider with email '[email protected]' already exists."
  ]
}

Body (Example: Missing Required Field)

{
    "error": "Bad Request: Missing required field",
    "details": "Missing key: 'email'"
}

❌ Error Response (401 Unauthorized)

Returned if the x-api-key header is missing or the provided key is invalid.

Body

{
  "error": "Unauthorized Access"
}
❗️

More than five failed authentication attempts will result in a permanent IP block.


❌ Error Response (500 Internal Server Error)

Returned for database errors or other unexpected issues on the server during the creation process.

Body

{
  "error": "An internal server error occurred",
  "details": "Specific error message from the server."
}