Home


Offer Code API

This API provides two endpoints for managing offer codes and associated shortcodes. Both endpoints use POST methods and expect data in form format with an API key for authentication.

Tiered Access Plans

To request an API-Key, DM @steppsr on X.

Table of Contents

Endpoints

GET Offer

Description: This endpoint fetches the offer code, description, and a unique offer ID based on the provided short_code from the database.

GET Shortcode

Description: This endpoint generates or retrieves a short code for a given offer_code. If no short code exists for the offer code, a new unique short code is generated, inserted into the database, and returned.

Authentication

Error Handling

Usage Examples

Using curl

# For GET Offer
curl -X POST -d "api_key=YOUR_API_KEY&short_code=9K1xX" "https://offerco.de/api/v1/getoffer"

# For GET Shortcode (standard form method)
curl -X POST -d "api_key=YOUR_API_KEY&offer_code=OFFER_CODE&description=This%20is%20a%20test%20offer" "https://offerco.de/api/v1/getshortcode"

# For GET Shortcode (using form-data to avoid URL encoding)
curl -X POST -F "api_key=YOUR_API_KEY" -F "offer_code=OFFER_CODE" -F "description=This is a test offer" "https://offerco.de/api/v1/getshortcode"

Using Javascript

// For GET Offer
fetch('https://offerco.de/api/v1/getoffer', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded',
  },
  body: 'api_key=YOUR_API_KEY&short_code=XXXXX'
})
.then(response => response.json())
.then(data => console.log(data));

// For GET Shortcode (standard form method)
fetch('https://offerco.de/api/v1/getshortcode', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded',
  },
  body: 'api_key=YOUR_API_KEY&offer_code=OFFER_CODE&description=This%20is%20a%20test%20offer'
})
.then(response => response.json())
.then(data => console.log(data));

// For GET Shortcode (using FormData to avoid manual URL encoding)
const formData = new FormData();
formData.append('api_key', 'YOUR_API_KEY');
formData.append('offer_code', 'OFFER_CODE');
formData.append('description', 'This is a test offer');

fetch('https://offerco.de/api/v1/getshortcode', {
  method: 'POST',
  body: formData
})
.then(response => response.json())
.then(data => console.log(data));

Response Structure

{
  "status": "success",
  "data": {
    "short_code": "string",
    "offer_code": "string",
    "description": "string",
    "offer_id": "string"
  }
}
{
    "status": "error",
    "data": [],
    "message": "string"
  }