Create API keys
Generate an API key and secret pair used to authenticate server-to-server requests for the MTN developer route. In Ziba Pay, API keys are managed and configured as gateway configs (gatewayConfigs).
POST
/developer/gatewayConfigsAPIAuthentication:Bearer token
Authorization: Bearer <token>Security requirement: 403 CSRF Protection
Direct server-to-server calls authenticated via Bearer tokens do not require CSRF headers. If you instead invoke mutation endpoints from a web browser using cookie-based sessions, you must include the following header:
X-Requested-With: XMLHttpRequestRequest body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Required | Human-readable label for this API key pair (e.g., 'Production Webhook Server', 'Mobile App Checkout'). |
description | string | Required | System, service, or environment using this key. |
One-Time Secret Notice · apiSecret
The apiSecret is returned only once in plaintext upon creation. Ziba Pay stores only a one-way cryptographic hash. Copy and save this secret immediately in a secure vault or environment variables. It cannot be recovered or retrieved again later through list or get endpoints.
Response fields
| Field | Type | Presence | Description |
|---|---|---|---|
id | string | Always returned | Unique identifier for this gateway configuration. Required when revoking the key via DELETE. |
apiKey | string | Always returned | Public API key identifier. Pass this in the x-api-key HTTP header. |
apiSecret | string | Always returned | One-time plaintext secret. Returned only on creation. Pass this in the x-api-secret header. Stored as an irreversible hash. |
name | string | Always returned | Descriptive label provided during creation. |
description | string | Always returned | Environment or system description provided during creation. |
userId | string | Always returned | Merchant user ID owning this API credential. |
createdAt | string | Optional | ISO 8601 creation timestamp. |
Status codes
| HTTP Status | Meaning |
|---|---|
| 201 | API key and secret generated successfully. |
| 400 | Name or description missing. Body is { status: "fail", message }. |
| 401 | No merchant session. Missing or expired Bearer token. |
Notes
- Terminology: An API key in Ziba Pay is a gateway config object (`gatewayConfig`). Creating this resource generates the API key and secret pair.
- Authentication scope: Server-to-server API calls authenticate with Bearer tokens or API keys. Browser-based requests using session cookies require X-Requested-With.
- Who uses this: Backend services initiating automated payments.
- When to use (gateway section): Use this key pair in x-api-key and x-api-secret headers when calling POST /payment/gateway-momo-pay. Prefer the Bearer production collect route for published samples.
- Authentication: x-api-key + x-api-secret on the gateway collect route (/payment/gateway-momo-pay; legacy alias /payment/dev-momo-pay). Prefer the production Bearer route (/payment/mtn-momo-pay) for documented samples. Both auth styles are intentional.