API Keys
Crear una nueva API key
const url = 'https://api.inspow.tech/api/v1/api-keys';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"Payment System Integration","description":"API key to allow the payment system to query invoices and create payments","scopes":["read_write"],"allowedOrigins":["https://mi-sistema.com","https://staging.mi-sistema.com"],"allowedIPs":["192.168.1.100","10.0.0.50"],"expiresAt":"2024-12-31T23:59:59.000Z","rateLimit":1000,"metadata":{"environment":"production","version":"1.0"},"createdBy":"645cc3d3f8a9c9a2b88a22c4","updatedBy":"645cc3d3f8a9c9a2b88a22c5","tenant_id":"645cc3d3f8a9c9a2b88a22c6"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.inspow.tech/api/v1/api-keys \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "Payment System Integration", "description": "API key to allow the payment system to query invoices and create payments", "scopes": [ "read_write" ], "allowedOrigins": [ "https://mi-sistema.com", "https://staging.mi-sistema.com" ], "allowedIPs": [ "192.168.1.100", "10.0.0.50" ], "expiresAt": "2024-12-31T23:59:59.000Z", "rateLimit": 1000, "metadata": { "environment": "production", "version": "1.0" }, "createdBy": "645cc3d3f8a9c9a2b88a22c4", "updatedBy": "645cc3d3f8a9c9a2b88a22c5", "tenant_id": "645cc3d3f8a9c9a2b88a22c6" }'Genera una nueva API key con los permisos especificados
Authorizations
Sección titulada «Authorizations »Request Body required
Sección titulada «Request Body required »object
Descriptive name for the API key
Example
Payment System IntegrationDetailed description of the API key purpose
Example
API key to allow the payment system to query invoices and create paymentsPermisos/alcances de la API key
Example
[ "read_write"]Dominios permitidos para usar la API key
Example
[ "https://mi-sistema.com", "https://staging.mi-sistema.com"]IPs permitidas para usar la API key
Example
[ "192.168.1.100", "10.0.0.50"]Fecha de expiración de la API key (ISO string)
Example
2024-12-31T23:59:59.000ZLímite de requests por hora
Example
1000Metadatos adicionales en formato JSON
object
Example
{ "environment": "production", "version": "1.0"}User who created this plan (filled automatically).
Example
645cc3d3f8a9c9a2b88a22c4User who last modified this plan (filled automatically).
Example
645cc3d3f8a9c9a2b88a22c5Tenant ID associated with this API key (auto-filled from authenticated user)
Example
645cc3d3f8a9c9a2b88a22c6Responses
Sección titulada « Responses »API key creada exitosamente
object
object
Información de la API key (sin la clave raw)
object
La clave completa (solo se muestra una vez)
Example
{ "success": true, "message": "API key creada exitosamente", "data": { "rawKey": "ak_1234567890abcdef.fedcba0987654321..." }}