Ir al contenido

API Keys

Crear una nueva API key

POST
/api-keys
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

Media type application/json
object
name
required

Descriptive name for the API key

string
<= 100 characters
Example
Payment System Integration
description

Detailed description of the API key purpose

string
<= 500 characters
Example
API key to allow the payment system to query invoices and create payments
scopes

Permisos/alcances de la API key

Array<string>
Allowed values: read_only write_only read_write admin
Example
[
"read_write"
]
allowedOrigins

Dominios permitidos para usar la API key

Array<string>
Example
[
"https://mi-sistema.com",
"https://staging.mi-sistema.com"
]
allowedIPs

IPs permitidas para usar la API key

Array<string>
Example
[
"192.168.1.100",
"10.0.0.50"
]
expiresAt

Fecha de expiración de la API key (ISO string)

string
Example
2024-12-31T23:59:59.000Z
rateLimit

Límite de requests por hora

number
>= 1 <= 10000
Example
1000
metadata

Metadatos adicionales en formato JSON

object
Example
{
"environment": "production",
"version": "1.0"
}
createdBy

User who created this plan (filled automatically).

string format: MongoId
Example
645cc3d3f8a9c9a2b88a22c4
updatedBy

User who last modified this plan (filled automatically).

string format: MongoId
Example
645cc3d3f8a9c9a2b88a22c5
tenant_id

Tenant ID associated with this API key (auto-filled from authenticated user)

string format: MongoId
Example
645cc3d3f8a9c9a2b88a22c6

API key creada exitosamente

Media type application/json
object
success
boolean
message
string
data
object
apiKey

Información de la API key (sin la clave raw)

object
rawKey

La clave completa (solo se muestra una vez)

string
Example
{
"success": true,
"message": "API key creada exitosamente",
"data": {
"rawKey": "ak_1234567890abcdef.fedcba0987654321..."
}
}