X.gd Developers
Proporcionamos una API para acortar URL desde aplicaciones externas. Se requiere una clave API para usar la API.
API de acortamiento de URL
Shorten API v1.0
GET https://xgd.io/V1/shorten
Solicitud
| * | Parameter | Type | Format | Description | Example |
|---|---|---|---|---|---|
| * | url | String | http(s):// | URL a acortar | https://example.com |
| shortid | String | [0-9a-zA-Z_]{6,15} | URL corta personalizada. Asignación aleatoria si se omite | example | |
| analytics | String | true / false | Habilitar análisis de acceso. Habilitado si se omite | true | |
| filterbots | String | true / false | Filtrado de bots cuando el análisis está habilitado. Deshabilitado si se omite | false | |
| * | key | String | [0-9a-f]{32} | Clave API emitida | 0af50e06255c7004f9ad71338f5ad56e |
Ejemplo de solicitud (URL)
https://xgd.io/V1/shorten?url=https://example.com&key={Your API Key}Ejemplo de solicitud (cURL)
curl -X GET 'https://xgd.io/V1/shorten?url=https://example.com&key={Your API Key}'Respuesta (Éxito)
| * | Parameter | Type | Format | Description | Example |
|---|---|---|---|---|---|
| * | status | Number | 200 | Código de estado | 200 |
| * | shorturl | String | https://x.gd/[0-9a-zA-Z_]+ | URL acortada | https://x.gd/example |
| * | analytics | Boolean | true / false | Análisis de acceso | true |
| * | filterbots | Boolean | true / false | Filtrado de bots | false |
| * | originalurl | String | http(s):// | URL original | https://example.com |
Ejemplo de respuesta
status: 200
content-type: application/json
{
"status": 200,
"shorturl": "https://x.gd/example",
"analytics": true,
"filterbots": false,
"originalurl": "https://example.com/"
}Respuesta (Fallo)
| * | Parameter | Type | Format | Description | Example |
|---|---|---|---|---|---|
| * | status | Number | 400 / 401 / 403 / 409 / 429 / 500 / 503 | Código de estado | 429 |
| * | message | String | - | Mensaje de error | Too many requests. |
Ejemplo de respuesta
status: 200
content-type: application/json
{
"status": 429,
"message": "Too many requests."
}Código de estado
| Status | Description |
|---|---|
| 200 | La respuesta es normal. |
| 400 | Ocurrió un error en la solicitud. El mensaje contiene detalles. |
| 401 | El token no es válido. Verifica tu clave API. |
| 403 | Temporalmente o permanentemente no disponible. |
| 409 | No se puede emitir URL acortada bajo las condiciones solicitadas. El mensaje contiene detalles. |
| 429 | Límite de uso de API alcanzado. Espera hasta que se levante el límite y vuelve a intentarlo. |
| 500 | Ocurrió un error temporal del sistema. Vuelve a intentarlo después de un tiempo. |
| 503 | El servicio está temporalmente no disponible. Vuelve a intentarlo después de un tiempo. |
Clave API
Enviaremos una URL para emitir una clave API a la dirección de correo electrónico que proporcionaste.
Debes completar el procedimiento dentro de las 24 horas posteriores al envío.