🔑 API Dokumentation

Komplett guide för att integrera med Redirects API

📋 Översikt

Redirects API lÄter dig hantera dina domÀn-redirects programmatiskt. Perfekt för automation, integrationer och custom dashboards.

✅ Base URL: https://portal.eazy.direct/api

🔐 Autentisering

Alla API-requests krÀver en API-nyckel som skickas i request headers.

Skapa API Key

1. Logga in pÄ portalen
2. GĂ„ till "🔑 API Keys"
3. Klicka "Skapa ny API Key"
4. Spara nyckeln sÀkert (visas bara en gÄng!)

AnvÀnd API Key

LĂ€gg till header X-API-Key i alla requests:

curl -H "X-API-Key: redir_din_nyckel_hÀr" https://portal.eazy.direct/api/domains
⚠ Viktigt: HĂ„ll din API-nyckel hemlig! Dela den aldrig publikt eller i frontend-kod.

⏱ Rate Limits

Plan Requests/mÄnad Burst limit
Basic 1,000 10/minut
Pro 10,000 50/minut

🎯 Endpoints

GET /api/domains

Beskrivning: HÀmta alla dina domÀner

Request:

curl -H "X-API-Key: redir_din_nyckel" \
  https://portal.eazy.direct/api/domains

Response:

{
  "domains": [
    {
      "id": 1,
      "domain": "exempel.se",
      "target_url": "https://mÄlsida.se",
      "redirect_type": "301",
      "status": "active",
      "created_at": "2026-01-17T12:00:00Z"
    }
  ]
}

POST /api/domains

Beskrivning: LÀgg till en ny domÀn

Request Body:

Parameter Typ Beskrivning
domain string DomÀnnamn (t.ex. "exempel.se")
target_url string MÄlwebbplats (inkl. https://)
redirect_type string "301" eller "frame"

Request:

curl -X POST \
  -H "X-API-Key: redir_din_nyckel" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "exempel.se",
    "target_url": "https://mÄlsida.se",
    "redirect_type": "301"
  }' \
  https://portal.eazy.direct/api/domains

Response:

{
  "message": "Domain added successfully",
  "domain": {
    "id": 2,
    "domain": "exempel.se",
    "target_url": "https://mÄlsida.se",
    "redirect_type": "301",
    "status": "pending",
    "dns_instructions": {
      "ip": "206.81.27.176",
      "records": [
        {"type": "A", "name": "@", "value": "206.81.27.176"},
        {"type": "A", "name": "www", "value": "206.81.27.176"}
      ]
    }
  }
}

PUT /api/domains/:id

Beskrivning: Uppdatera en befintlig domÀn

Request:

curl -X PUT \
  -H "X-API-Key: redir_din_nyckel" \
  -H "Content-Type: application/json" \
  -d '{
    "target_url": "https://ny-mÄlsida.se",
    "redirect_type": "frame"
  }' \
  https://portal.eazy.direct/api/domains/2

Response:

{
  "message": "Domain updated successfully",
  "domain": "exempel.se",
  "new_target": "https://ny-mÄlsida.se",
  "redirect_type": "frame"
}

DELETE /api/domains/:id

Beskrivning: Ta bort en domÀn

Request:

curl -X DELETE \
  -H "X-API-Key: redir_din_nyckel" \
  https://portal.eazy.direct/api/domains/2

Response:

{
  "message": "Domain deleted successfully",
  "domain": "exempel.se"
}

GET /api/domains/:id/check-dns

Beskrivning: Verifiera DNS-konfiguration

Request:

curl -H "X-API-Key: redir_din_nyckel" \
  https://portal.eazy.direct/api/domains/2/check-dns

Response:

{
  "domain": "exempel.se",
  "dns_ok": true,
  "current_ip": "206.81.27.176",
  "expected_ip": "206.81.27.176",
  "status": "active"
}

❌ Felhantering

Status Code Betydelse
200 Success
400 Bad Request (ogiltig data)
401 Unauthorized (ogiltig API-nyckel)
403 Forbidden (ej tillÄten funktion i din plan)
404 Not Found (domÀn finns inte)
429 Rate Limit Exceeded
500 Server Error

Fel-response exempel:

{
  "error": "API key required"
}

💬 Support

Behöver du hjÀlp? Kontakta oss:

© 2026 Redirects API · Version 1.0