### Get All Supports for Current User (Backer View) Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieves all support entries for the currently authenticated member. Requires member JWT for authorization. ```bash curl -X GET http://localhost:3000/microcredit/supports \ -H "Authorization: Bearer " ``` -------------------------------- ### Get Loyalty Statistics (Partner) Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieve loyalty program statistics for a partner. This endpoint requires partner authentication. ```bash # Get loyalty statistics (partner only) curl -X GET http://localhost:3000/loyalty/statistics \ -H "Authorization: Bearer " ``` -------------------------------- ### Get All Supports for a Specific Campaign (Partner View) Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieves all support entries for a given campaign, viewable by partners. Requires partner JWT for authorization. ```bash curl -X GET http://localhost:3000/microcredit/supports/507f1f77bcf86cd799439012/campaign789 \ -H "Authorization: Bearer " ``` -------------------------------- ### Get Microcredit Activity Badge Source: https://context7.com/synergatika/synergy-api/llms.txt Fetches the microcredit activity badge for the authenticated user. Requires JWT for authorization. ```bash curl -X GET http://localhost:3000/microcredit/badge \ -H "Authorization: Bearer " ``` -------------------------------- ### GET /partners/public/{params} Source: https://context7.com/synergatika/synergy-api/llms.txt Lists all public partners with pagination and filtering options. ```APIDOC ## GET /partners/public/{limit}-{skip}-{active_only} ### Description Lists all public partners using pagination parameters. ### Method GET ### Endpoint http://localhost:3000/partners/public/{limit}-{skip}-{active_only} ### Parameters #### Path Parameters - **limit** (integer) - Required - Number of items to return - **skip** (integer) - Required - Number of items to skip - **active_only** (integer) - Required - Filter by active status (0 or 1) ### Response #### Success Response (200) - **data** (array) - List of partner objects - **code** (integer) - Status code #### Response Example { "data": [ { "id": "507f1f77bcf86cd799439012", "name": "Coffee House", "slug": "coffee-house", "email": "partner@coffeehouse.com" } ], "code": 200 } ``` -------------------------------- ### Get Specific Post Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieves a single community post by its partner's slug and the post's slug. ```bash curl -X GET http://localhost:3000/posts/coffee-house/welcome-post ``` -------------------------------- ### GET /profile Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieves the profile information for the currently authenticated user. ```APIDOC ## GET /profile ### Description Retrieves the current user's profile information. ### Method GET ### Endpoint http://localhost:3000/profile ### Response #### Success Response (200) - **data** (object) - User profile data - **code** (integer) - Status code #### Response Example { "data": { "id": "507f1f77bcf86cd799439011", "email": "user@example.com", "name": "John Doe", "imageURL": "http://api.example.com/assets/static/profile.jpg", "createdAt": "2024-01-15T10:30:00Z" }, "code": 200 } ``` -------------------------------- ### Get Specific Loyalty Offer Details Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieve the details of a specific loyalty offer. Requires the partner's slug and the offer's slug. ```bash # Get specific offer details curl -X GET http://localhost:3000/loyalty/offers/coffee-house/free-coffee ``` -------------------------------- ### Get Microcredit Transactions (Paginated) Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieves a paginated list of microcredit transactions. Requires JWT for authorization. ```bash curl -X GET http://localhost:3000/microcredit/transactions/20-0-1 \ -H "Authorization: Bearer " ``` -------------------------------- ### GET /microcredit/campaigns/public/:params Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieves a paginated list of public microcredit campaigns. ```APIDOC ## GET /microcredit/campaigns/public/:params ### Description Fetches a list of public crowdfunding campaigns. ### Method GET ### Endpoint http://localhost:3000/microcredit/campaigns/public/:params ### Parameters #### Path Parameters - **params** (string) - Required - Pagination parameters (e.g., 10-0-1) ### Response #### Success Response (200) - **data** (array) - List of campaign objects - **code** (number) - 200 ``` -------------------------------- ### Get Loyalty Offers by Partner Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieve a paginated list of public loyalty offers for a specific partner. Requires the partner's slug and pagination parameters. ```bash # Get offers by specific partner curl -X GET "http://localhost:3000/loyalty/offers/public/coffee-house/10-0-1" ``` -------------------------------- ### Get Specific Backer's Supports for a Campaign Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieves support entries for a specific member within a given campaign. Requires partner JWT for authorization. ```bash curl -X GET http://localhost:3000/microcredit/supports/507f1f77bcf86cd799439012/campaign789/member@example.com \ -H "Authorization: Bearer " ``` -------------------------------- ### GET /microcredit/transactions/:params Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieves a paginated list of microcredit transactions. ```APIDOC ## GET /microcredit/transactions/:params ### Description Retrieves a paginated list of microcredit transactions. ### Method GET ### Endpoint /microcredit/transactions/:params ### Parameters #### Path Parameters - **params** (string) - Required - Pagination parameters. ### Response #### Success Response (200) - **data** (array) - List of transaction objects. ``` -------------------------------- ### Get Member's Loyalty Balance (Partner) Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieve the loyalty points balance for a specific member. This endpoint is for partners to check their members' balances and requires partner authentication. ```bash # Get member's balance (partner checking member) curl -X GET http://localhost:3000/loyalty/balance/member@example.com \ -H "Authorization: Bearer " ``` -------------------------------- ### Get Posts by Specific Partner Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieves public posts associated with a particular partner, paginated. Uses partner's slug for identification. ```bash curl -X GET "http://localhost:3000/posts/public/coffee-house/10-0-1" ``` -------------------------------- ### Get Loyalty Balance (Authenticated User) Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieve the loyalty points balance for the currently authenticated user. Requires user JWT token. ```bash # Get loyalty balance (authenticated user) curl -X GET http://localhost:3000/loyalty/balance \ -H "Authorization: Bearer " ``` -------------------------------- ### Get Loyalty Activity Badge Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieve the loyalty activity badge for the authenticated user. This badge is based on accumulated points, stores visited, and transactions made. ```bash # Get loyalty activity badge curl -X GET http://localhost:3000/loyalty/badge \ -H "Authorization: Bearer " ``` -------------------------------- ### Get Loyalty Transactions (Paginated) Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieve a paginated list of loyalty transactions for the authenticated user. The URL includes parameters for page number, items per page, and sort order. ```bash # Get loyalty transactions (paginated) curl -X GET http://localhost:3000/loyalty/transactions/20-0-1 \ -H "Authorization: Bearer " ``` -------------------------------- ### Manage Static Content Source: https://context7.com/synergatika/synergy-api/llms.txt Endpoints for retrieving and creating multilingual static content items. ```bash curl -X GET http://localhost:3000/content ``` ```json { "data": [ { "_id": "content123", "name": "terms-of-service", "el_title": "Όροι Χρήσης", "en_title": "Terms of Service", "el_content": "Greek content...", "en_content": "English content..." } ], "code": 200 } ``` ```bash curl -X GET http://localhost:3000/content/terms-of-service ``` ```bash curl -X POST http://localhost:3000/content \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "name": "privacy-policy", "el_title": "Πολιτική Απορρήτου", "en_title": "Privacy Policy", "el_content": "Greek privacy policy content...", "en_content": "English privacy policy content..." }' ``` -------------------------------- ### Build Synergy API Docker Image Source: https://github.com/synergatika/synergy-api/blob/main/README.md Executes a build of the API image using the current directory context. ```bash docker build -t synergatika/synergy-api:latest . ``` -------------------------------- ### POST /microcredit/campaigns/ Source: https://context7.com/synergatika/synergy-api/llms.txt Creates a new microcredit crowdfunding campaign. ```APIDOC ## POST /microcredit/campaigns/ ### Description Creates a new crowdfunding campaign for partners. ### Method POST ### Endpoint http://localhost:3000/microcredit/campaigns/ ### Request Body - **title** (string) - Required - **subtitle** (string) - Required - **description** (string) - Required - **terms** (string) - Required - **category** (string) - Required - **access** (string) - Required - **quantitative** (boolean) - Required - **redeemable** (boolean) - Required - **stepAmount** (number) - Required - **minAllowed** (number) - Required - **maxAllowed** (number) - Required - **maxAmount** (number) - Required - **startsAt** (number) - Required - **expiresAt** (number) - Required - **redeemStarts** (number) - Required - **redeemEnds** (number) - Required - **imageURL** (file) - Required ### Response #### Success Response (201) - **data** (object) - Created campaign details - **code** (number) - 201 ``` -------------------------------- ### POST /loyalty/offers/ Source: https://context7.com/synergatika/synergy-api/llms.txt Creates a new loyalty offer for partners. ```APIDOC ## POST /loyalty/offers/ ### Description Creates a new loyalty offer. Requires partner authentication. ### Method POST ### Endpoint http://localhost:3000/loyalty/offers/ ### Request Body - **title** (string) - Required - Offer title - **subtitle** (string) - Required - Offer subtitle - **description** (string) - Required - Offer description - **instructions** (string) - Required - Redemption instructions - **cost** (number) - Required - Cost in tokens - **expiresAt** (number) - Required - Expiration timestamp - **imageURL** (file) - Required - Offer image file ### Response #### Success Response (201) - **message** (string) - Success message - **code** (number) - 201 ``` -------------------------------- ### POST /posts/ Source: https://context7.com/synergatika/synergy-api/llms.txt Creates a new community post by a partner. ```APIDOC ## POST /posts/ ### Description Creates a new community post by a partner. ### Method POST ### Endpoint /posts/ ### Parameters #### Request Body - **title** (string) - Required - Post title. - **subtitle** (string) - Required - Post subtitle. - **description** (string) - Required - Post content. - **access** (string) - Required - Access level (public, private, partners-only). - **imageURL** (file) - Optional - Post image file. ``` -------------------------------- ### List Microcredit Campaigns Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieve public or private microcredit campaigns using pagination parameters. ```bash curl -X GET "http://localhost:3000/microcredit/campaigns/public/10-0-1" ``` ```bash curl -X GET "http://localhost:3000/microcredit/campaigns/private/10-0-1" \ -H "Authorization: Bearer " ``` ```bash curl -X GET "http://localhost:3000/microcredit/campaigns/public/coffee-house/10-0-1" ``` ```bash curl -X GET http://localhost:3000/microcredit/campaigns/coffee-house/new-espresso-machine ``` -------------------------------- ### Manage Posts via API Source: https://context7.com/synergatika/synergy-api/llms.txt Endpoints for updating and deleting existing posts using partner authentication. ```bash curl -X PUT http://localhost:3000/posts/507f1f77bcf86cd799439012/post123 \ -H "Authorization: Bearer " \ -F "title=Updated Post Title" \ -F "description=Updated content..." ``` ```bash curl -X DELETE http://localhost:3000/posts/507f1f77bcf86cd799439012/post123 \ -H "Authorization: Bearer " ``` -------------------------------- ### List Public Loyalty Offers (Paginated) Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieve a paginated list of all public loyalty offers. This endpoint does not require authentication. ```bash # List all public offers (paginated) curl -X GET "http://localhost:3000/loyalty/offers/public/10-0-1" ``` -------------------------------- ### Authentication API Endpoints Source: https://context7.com/synergatika/synergy-api/llms.txt Handles user registration, login, password management, and email verification using JWT-based authentication. ```bash # Authenticate a user (login) curl -X POST http://localhost:3000/auth/authenticate \ -H "Content-Type: application/json" \ -d '{ "email": "user@example.com", "password": "securePassword123" }' # Response { "user": { "id": "507f1f77bcf86cd799439011", "email": "user@example.com", "name": "John Doe", "imageURL": "http://api.example.com/assets/static/profile.jpg", "access": "member", "email_verified": true, "pass_verified": true }, "token": { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "expiresIn": "24h" } } # Register a new member (auto-registration) curl -X POST http://localhost:3000/auth/auto-register/member \ -H "Content-Type: application/json" \ -d '{ "name": "John Doe", "email": "newuser@example.com", "password": "securePassword123" }' # Request password restoration curl -X GET http://localhost:3000/auth/forgot_pass/user@example.com # Verify email with token curl -X POST http://localhost:3000/auth/verify_email \ -H "Content-Type: application/json" \ -d '{ "token": "verification-token-uuid" }' # Change password (authenticated user) curl -X PUT http://localhost:3000/auth/change_pass \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "oldPassword": "currentPassword", "newPassword": "newSecurePassword" }' ``` -------------------------------- ### Create New Post (Partner Only) Source: https://context7.com/synergatika/synergy-api/llms.txt Allows a partner to create a new community post. Requires partner JWT for authorization and accepts form data for post content and image. ```bash curl -X POST http://localhost:3000/posts/ \ -H "Authorization: Bearer " \ -F "title=Welcome to Coffee House" \ -F "subtitle=Our story" \ -F "description=We are excited to share our journey..." \ -F "access=public" \ -F "imageURL=@/path/to/post-image.jpg" ``` -------------------------------- ### Partner Creates Support on Behalf of Member Source: https://context7.com/synergatika/synergy-api/llms.txt Enables a partner to create a support entry for a member on a campaign. Requires partner JWT for authorization. ```bash curl -X POST http://localhost:3000/microcredit/earn/507f1f77bcf86cd799439012/campaign789/member@example.com \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "_amount": 50, "method": "store", "paid": true }' ``` -------------------------------- ### List All Public Posts (Paginated) Source: https://context7.com/synergatika/synergy-api/llms.txt Retrieves a paginated list of publicly accessible community posts. ```bash curl -X GET "http://localhost:3000/posts/public/10-0-1" ``` -------------------------------- ### POST /auth/authenticate Source: https://context7.com/synergatika/synergy-api/llms.txt Authenticates a user and returns a JWT token for session management. ```APIDOC ## POST /auth/authenticate ### Description Authenticates a user and returns a JWT token. ### Method POST ### Endpoint http://localhost:3000/auth/authenticate ### Request Body - **email** (string) - Required - User email address - **password** (string) - Required - User password ### Request Example { "email": "user@example.com", "password": "securePassword123" } ### Response #### Success Response (200) - **user** (object) - User details - **token** (object) - JWT token and expiration #### Response Example { "user": { "id": "507f1f77bcf86cd799439011", "email": "user@example.com", "name": "John Doe", "imageURL": "http://api.example.com/assets/static/profile.jpg", "access": "member", "email_verified": true, "pass_verified": true }, "token": { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "expiresIn": "24h" } } ``` -------------------------------- ### Confirm Support Payment (Partner) Source: https://context7.com/synergatika/synergy-api/llms.txt Allows a partner to confirm a member's payment for a support entry. Requires partner JWT for authorization. ```bash curl -X PUT http://localhost:3000/microcredit/confirm/507f1f77bcf86cd799439012/campaign789/support123 \ -H "Authorization: Bearer " ``` -------------------------------- ### Manage Loyalty Offers Source: https://context7.com/synergatika/synergy-api/llms.txt Endpoints for creating, updating, and deleting loyalty offers. Requires a partner JWT token for authorization. ```bash curl -X POST http://localhost:3000/loyalty/offers/ \ -H "Authorization: Bearer " \ -F "title=Free Coffee" \ -F "subtitle=Any size, any type" \ -F "description=Redeem for a free coffee of your choice" \ -F "instructions=Show this offer at the counter" \ -F "cost=500" \ -F "expiresAt=1735689600000" \ -F "imageURL=@/path/to/offer-image.jpg" ``` ```bash curl -X PUT http://localhost:3000/loyalty/offers/507f1f77bcf86cd799439012/offer456 \ -H "Authorization: Bearer " \ -F "title=Premium Coffee" \ -F "subtitle=Large size only" \ -F "description=Updated offer description" \ -F "instructions=Updated instructions" \ -F "cost=600" \ -F "expiresAt=1767225600000" ``` ```bash curl -X DELETE http://localhost:3000/loyalty/offers/507f1f77bcf86cd799439012/offer456 \ -H "Authorization: Bearer " ``` -------------------------------- ### Partners API Endpoints Source: https://context7.com/synergatika/synergy-api/llms.txt Provides access to partner business profiles, supporting pagination and lookup by ID or slug. ```bash # List all public partners (paginated) curl -X GET "http://localhost:3000/partners/public/10-0-1" # Format: {limit}-{skip}-{active_only: 0|1} # Response { "data": [ { "id": "507f1f77bcf86cd799439012", "name": "Coffee House", "slug": "coffee-house", "email": "partner@coffeehouse.com", "imageURL": "http://api.example.com/assets/static/partner.jpg", "sector": "Food", "description": "Best coffee in town", "subtitle": "Since 2010", "address": { "street": "123 Main St", "postCode": "12345", "city": "Athens" }, "payments": [ { "bic": "ETHNGRAA", "name": "National Bank", "value": "GR1234567890" } ], "createdAt": "2024-01-10T08:00:00Z" } ], "code": 200 } # Get specific partner by ID or slug curl -X GET http://localhost:3000/partners/coffee-house ``` -------------------------------- ### Manage Microcredit Campaigns Source: https://context7.com/synergatika/synergy-api/llms.txt Endpoints for creating, publishing, updating, and deleting microcredit campaigns. Publishing activates the campaign on the blockchain. ```bash curl -X POST http://localhost:3000/microcredit/campaigns/ \ -H "Authorization: Bearer " \ -F "title=New Espresso Machine Fund" \ -F "subtitle=Help us upgrade our equipment" \ -F "description=We are raising funds for a new professional espresso machine" \ -F "terms=Supporters will receive coffee credits" \ -F "category=Equipment" \ -F "access=public" \ -F "quantitative=true" \ -F "redeemable=true" \ -F "stepAmount=10" \ -F "minAllowed=10" \ -F "maxAllowed=500" \ -F "maxAmount=5000" \ -F "startsAt=1704067200000" \ -F "expiresAt=1735689600000" \ -F "redeemStarts=1706745600000" \ -F "redeemEnds=1738368000000" \ -F "imageURL=@/path/to/campaign-image.jpg" ``` ```bash curl -X PUT http://localhost:3000/microcredit/campaigns/507f1f77bcf86cd799439012/campaign789/publish \ -H "Authorization: Bearer " ``` ```bash curl -X PUT http://localhost:3000/microcredit/campaigns/507f1f77bcf86cd799439012/campaign789 \ -H "Authorization: Bearer " \ -F "title=Updated Campaign Title" \ -F "maxAmount=10000" ``` ```bash curl -X DELETE http://localhost:3000/microcredit/campaigns/507f1f77bcf86cd799439012/campaign789 \ -H "Authorization: Bearer " ``` -------------------------------- ### Update Partner Profile Source: https://context7.com/synergatika/synergy-api/llms.txt Use this endpoint to update a partner's profile information. Ensure you are authenticated as the partner. ```bash curl -X PUT http://localhost:3000/partners/507f1f77bcf86cd799439012 \ -H "Authorization: Bearer " \ -F "name=Coffee House Premium" \ -F "subtitle=Premium Coffee Experience" \ -F "description=The best premium coffee in town" \ -F "sector=Food" \ -F "phone=+30210123456" \ -F "street=123 Main Street" \ -F "postCode=12345" \ -F "city=Athens" \ -F "lat=37.9838" \ -F "long=23.7275" \ -F 'contacts=[{"slug":"website","name":"Website","value":"https://coffeehouse.com"}]' \ -F "imageURL=@/path/to/partner-logo.jpg" ``` -------------------------------- ### Manage Community Events Source: https://context7.com/synergatika/synergy-api/llms.txt Operations for listing, retrieving, creating, updating, and deleting community events. ```bash curl -X GET "http://localhost:3000/events/public/10-0-1" ``` ```bash curl -X GET "http://localhost:3000/events/private/10-0-1" \ -H "Authorization: Bearer " ``` ```bash curl -X GET "http://localhost:3000/events/public/coffee-house/10-0-1" ``` ```bash curl -X GET http://localhost:3000/events/coffee-house/grand-opening ``` ```json { "data": { "partner": { "_id": "507f1f77bcf86cd799439012", "name": "Coffee House", "slug": "coffee-house" }, "_id": "event456", "slug": "grand-opening", "imageURL": "http://api.example.com/assets/static/event.jpg", "title": "Grand Opening Party", "subtitle": "Join us for the celebration", "description": "Event details...", "access": "public", "location": "123 Main Street, Athens", "dateTime": 1706745600000, "createdAt": "2024-01-10T08:00:00Z" }, "code": 200 } ``` ```bash curl -X POST http://localhost:3000/events/ \ -H "Authorization: Bearer " \ -F "title=Grand Opening Party" \ -F "subtitle=Join us for the celebration" \ -F "description=We invite you to celebrate our grand opening..." \ -F "access=public" \ -F "location=123 Main Street, Athens" \ -F "dateTime=1706745600000" \ -F "imageURL=@/path/to/event-image.jpg" ``` ```bash curl -X PUT http://localhost:3000/events/507f1f77bcf86cd799439012/event456 \ -H "Authorization: Bearer " \ -F "title=Updated Event Title" \ -F "dateTime=1707350400000" ``` ```bash curl -X DELETE http://localhost:3000/events/507f1f77bcf86cd799439012/event456 \ -H "Authorization: Bearer " ``` -------------------------------- ### POST /microcredit/earn/:partner_id/:campaign_id Source: https://context7.com/synergatika/synergy-api/llms.txt Allows a member to pledge funds to a specific campaign. ```APIDOC ## POST /microcredit/earn/:partner_id/:campaign_id ### Description Allows a member to pledge funds to a specific campaign. ### Method POST ### Endpoint /microcredit/earn/:partner_id/:campaign_id ### Parameters #### Path Parameters - **partner_id** (string) - Required - The ID of the partner. - **campaign_id** (string) - Required - The ID of the campaign. #### Request Body - **_amount** (number) - Required - The amount to pledge. - **method** (string) - Required - The payment method. - **paid** (boolean) - Required - Payment status. ### Response #### Success Response (200) - **support_id** (string) - The ID of the support record. - **payment_id** (string) - The ID of the payment. - **status** (string) - The status of the support. - **method** (string) - The payment method used. ``` -------------------------------- ### Support a Campaign (Member) Source: https://context7.com/synergatika/synergy-api/llms.txt Allows a member to pledge funds to a specific campaign. Requires member JWT for authorization. ```bash curl -X POST http://localhost:3000/microcredit/earn/507f1f77bcf86cd799439012/campaign789 \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "_amount": 100, "method": "nationalBank", "paid": false }' ``` -------------------------------- ### Update Partner Payment Methods Source: https://context7.com/synergatika/synergy-api/llms.txt Update the payment methods for a partner. This requires the partner's JWT token and a JSON payload specifying the payment details. ```bash curl -X PUT http://localhost:3000/partners/payments/507f1f77bcf86cd799439012 \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "payments": [ { "bic": "ETHNGRAA", "name": "National Bank", "value": "GR1234567890123456789012" }, { "bic": "paypal", "name": "PayPal", "value": "payments@coffeehouse.com" } ] }' ``` -------------------------------- ### PUT /microcredit/campaigns/:partnerId/:campaignId/publish Source: https://context7.com/synergatika/synergy-api/llms.txt Publishes a campaign to the blockchain to activate it. ```APIDOC ## PUT /microcredit/campaigns/:partnerId/:campaignId/publish ### Description Activates a campaign by publishing it to the blockchain. ### Method PUT ### Endpoint http://localhost:3000/microcredit/campaigns/:partnerId/:campaignId/publish ### Parameters #### Path Parameters - **partnerId** (string) - Required - **campaignId** (string) - Required ### Response #### Success Response (200) - **message** (string) - Success message - **code** (number) - 200 ``` -------------------------------- ### Redeem Tokens (Partner) Source: https://context7.com/synergatika/synergy-api/llms.txt Enables a partner to redeem a member's tokens for a specific support entry. Requires partner JWT for authorization. ```bash curl -X POST http://localhost:3000/microcredit/redeem/507f1f77bcf86cd799439012/campaign789/support123 \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "_tokens": 25 }' ``` -------------------------------- ### User Profile API Endpoints Source: https://context7.com/synergatika/synergy-api/llms.txt Allows members to retrieve their profile information or update details including profile images. ```bash # Get current user profile curl -X GET http://localhost:3000/profile \ -H "Authorization: Bearer " # Response { "data": { "id": "507f1f77bcf86cd799439011", "email": "user@example.com", "name": "John Doe", "imageURL": "http://api.example.com/assets/static/profile.jpg", "createdAt": "2024-01-15T10:30:00Z" }, "code": 200 } # Update user profile with image upload curl -X PUT http://localhost:3000/profile \ -H "Authorization: Bearer " \ -F "name=John Updated" \ -F "imageURL=@/path/to/profile-image.jpg" ``` -------------------------------- ### Content Management API Source: https://context7.com/synergatika/synergy-api/llms.txt Endpoints for managing static content items, including retrieval, creation, and retrieval by ID or name. ```APIDOC ## GET /content ### Description Retrieves all content items. ### Method GET ### Endpoint /content ### Response #### Success Response (200) - **data** (array) - An array of content items. - Each item contains: - **_id** (string) - The unique identifier of the content item. - **name** (string) - The name of the content item. - **el_title** (string) - The title in Greek. - **en_title** (string) - The title in English. - **el_content** (string) - The content in Greek. - **en_content** (string) - The content in English. - **code** (integer) - The HTTP status code (200 for success). ### Response Example ```json { "data": [ { "_id": "content123", "name": "terms-of-service", "el_title": "Όροι Χρήσης", "en_title": "Terms of Service", "el_content": "Greek content...", "en_content": "English content..." } ], "code": 200 } ``` ## GET /content/{contentIdOrName} ### Description Retrieves a specific content item by its ID or name. ### Method GET ### Endpoint /content/{contentIdOrName} ### Parameters #### Path Parameters - **contentIdOrName** (string) - Required - The ID or name of the content item to retrieve. ## POST /content ### Description Creates a new content item. Requires admin authentication. ### Method POST ### Endpoint /content ### Headers - **Authorization** (string) - Required - Bearer token for admin authentication. - **Content-Type** (string) - Required - Application JSON. ### Request Body - **name** (string) - Required - The name of the content item. - **el_title** (string) - Required - The title in Greek. - **en_title** (string) - Required - The title in English. - **el_content** (string) - Required - The content in Greek. - **en_content** (string) - Required - The content in English. ### Request Example ```json { "name": "privacy-policy", "el_title": "Πολιτική Απορρήτου", "en_title": "Privacy Policy", "el_content": "Greek privacy policy content...", "en_content": "English privacy policy content..." } ``` ``` -------------------------------- ### Loyalty Offers API Source: https://context7.com/synergatika/synergy-api/llms.txt Endpoints for managing and retrieving loyalty offers. ```APIDOC ## GET /loyalty/offers/public/{page}-{limit}-{offset} ### Description Retrieves a paginated list of all public loyalty offers. ### Method GET ### Endpoint `/loyalty/offers/public/{page}-{limit}-{offset}` ### Parameters #### Path Parameters - **page** (number) - Required - The page number for pagination. - **limit** (number) - Required - The maximum number of items per page. - **offset** (number) - Required - The number of items to skip. ### Response #### Success Response (200) - **data** (array) - A list of public loyalty offers. - **partner** (object) - Information about the partner offering the item. - **_id** (string) - Partner's unique identifier. - **name** (string) - Partner's name. - **slug** (string) - Partner's slug. - **imageURL** (string) - URL of the partner's image. - **_id** (string) - Offer's unique identifier. - **slug** (string) - Offer's slug. - **imageURL** (string) - URL of the offer's image. - **title** (string) - Title of the offer. - **subtitle** (string) - Subtitle of the offer. - **cost** (number) - The number of loyalty points required to redeem the offer. - **description** (string) - Detailed description of the offer. - **instructions** (string) - Instructions for redeeming the offer. - **expiresAt** (number) - Timestamp indicating when the offer expires. - **code** (number) - The HTTP status code, expected to be 200. ```json { "data": [ { "partner": { "_id": "507f1f77bcf86cd799439012", "name": "Coffee House", "slug": "coffee-house", "imageURL": "http://api.example.com/assets/static/partner.jpg" }, "_id": "offer456", "slug": "free-coffee", "imageURL": "http://api.example.com/assets/static/offer.jpg", "title": "Free Coffee", "subtitle": "Any size, any type", "cost": 500, "description": "Redeem for a free coffee of your choice", "instructions": "Show this offer at the counter", "expiresAt": 1735689600000 } ], "code": 200 } ``` ``` ```APIDOC ## GET /loyalty/offers/public/{partner_slug}/{page}-{limit}-{offset} ### Description Retrieves a paginated list of public loyalty offers for a specific partner. ### Method GET ### Endpoint `/loyalty/offers/public/{partner_slug}/{page}-{limit}-{offset}` ### Parameters #### Path Parameters - **partner_slug** (string) - Required - The slug of the partner whose offers are to be retrieved. - **page** (number) - Required - The page number for pagination. - **limit** (number) - Required - The maximum number of items per page. - **offset** (number) - Required - The number of items to skip. ### Response #### Success Response (200) - **data** (array) - A list of public loyalty offers for the specified partner. (Structure is the same as the general public offers list). ``` ```APIDOC ## GET /loyalty/offers/{partner_slug}/{offer_slug} ### Description Retrieves the details of a specific loyalty offer. ### Method GET ### Endpoint `/loyalty/offers/{partner_slug}/{offer_slug}` ### Parameters #### Path Parameters - **partner_slug** (string) - Required - The slug of the partner. - **offer_slug** (string) - Required - The slug of the specific offer. ### Response #### Success Response (200) - **data** (object) - The details of the specific loyalty offer. (Structure is the same as an individual offer in the public offers list). ``` -------------------------------- ### Loyalty Points API Source: https://context7.com/synergatika/synergy-api/llms.txt Endpoints for managing loyalty points, including earning, redeeming, and checking balances. ```APIDOC ## POST /loyalty/earn/member@example.com ### Description Allows a partner to award loyalty points to a member. ### Method POST ### Endpoint `/loyalty/earn/{member_identifier}` ### Parameters #### Path Parameters - **member_identifier** (string) - Required - The email address or unique identifier of the member. #### Request Body - **_amount** (number) - Required - The base amount used to calculate points. Points are calculated as `amount * member_rate`. ### Request Example ```json { "_amount": 50 } ``` ### Response #### Success Response (201) - **data** (object) - Contains transaction details. - **tx** (string) - The transaction hash on the blockchain. - **logs** (array) - Logs associated with the transaction. - **code** (number) - The HTTP status code, expected to be 201. ```json { "data": { "tx": "0x1234567890abcdef...", "logs": [] }, "code": 201 } ``` ``` ```APIDOC ## POST /loyalty/redeem/member@example.com ### Description Allows a member to redeem loyalty points for a cash value. ### Method POST ### Endpoint `/loyalty/redeem/{member_identifier}` ### Parameters #### Path Parameters - **member_identifier** (string) - Required - The email address or unique identifier of the member. #### Request Body - **_points** (number) - Required - The number of loyalty points to redeem. ### Request Example ```json { "_points": 100 } ``` ``` ```APIDOC ## POST /loyalty/redeem/{partner_id}/offer123/member@example.com ### Description Allows a member to redeem loyalty points for a specific offer. ### Method POST ### Endpoint `/loyalty/redeem/{partner_id}/{offer_id}/{member_identifier}` ### Parameters #### Path Parameters - **partner_id** (string) - Required - The unique identifier of the partner offering the item. - **offer_id** (string) - Required - The unique identifier of the offer. - **member_identifier** (string) - Required - The email address or unique identifier of the member. #### Request Body - **_points** (number) - Required - The number of loyalty points to redeem. - **quantity** (number) - Optional - The quantity of the offer to redeem. Defaults to 1. ### Request Example ```json { "_points": 500, "quantity": 1 } ``` ``` ```APIDOC ## GET /loyalty/balance ### Description Retrieves the loyalty points balance for the currently authenticated user. ### Method GET ### Endpoint `/loyalty/balance` ### Response #### Success Response (200) - **data** (object) - Contains balance information. - **address** (string) - The user's loyalty points contract address. - **points** (number) - The current number of loyalty points. - **code** (number) - The HTTP status code, expected to be 200. ```json { "data": { "address": "0x2191eF87E392377ec08E7c08Eb105Ef5448eCED5", "points": 1500 }, "code": 200 } ``` ``` ```APIDOC ## GET /loyalty/balance/member@example.com ### Description Retrieves the loyalty points balance for a specific member, as viewed by a partner. ### Method GET ### Endpoint `/loyalty/balance/{member_identifier}` ### Parameters #### Path Parameters - **member_identifier** (string) - Required - The email address or unique identifier of the member. ### Response #### Success Response (200) - **data** (object) - Contains balance information. - **address** (string) - The member's loyalty points contract address. - **points** (number) - The current number of loyalty points. - **code** (number) - The HTTP status code, expected to be 200. ``` ```APIDOC ## GET /loyalty/badge ### Description Retrieves the loyalty activity badge and statistics for the authenticated user. ### Method GET ### Endpoint `/loyalty/badge` ### Response #### Success Response (200) - **data** (object) - Contains badge and activity statistics. - **amount** (number) - Total amount associated with loyalty activity. - **stores** (number) - Number of unique stores interacted with. - **transactions** (number) - Total number of loyalty transactions. - **rate** (number) - The current loyalty rate. - **badge** (string) - The assigned loyalty badge level (e.g., 'Helper', 'Gold'). - **code** (number) - The HTTP status code, expected to be 200. ```json { "data": { "amount": 500, "stores": 3, "transactions": 25, "rate": 2, "badge": "Helper" }, "code": 200 } ``` ``` ```APIDOC ## GET /loyalty/transactions/20-0-1 ### Description Retrieves a paginated list of loyalty transactions for the authenticated user. ### Method GET ### Endpoint `/loyalty/transactions/{page}-{limit}-{offset}` ### Parameters #### Path Parameters - **page** (number) - Required - The page number for pagination. - **limit** (number) - Required - The maximum number of items per page. - **offset** (number) - Required - The number of items to skip. ### Response #### Success Response (200) - **data** (array) - A list of loyalty transactions. - **_id** (string) - The unique identifier of the transaction. - **partner_id** (string) - The identifier of the partner involved. - **partner_name** (string) - The name of the partner. - **member_id** (string) - The identifier of the member involved. - **points** (number) - The number of points transacted. - **amount** (number) - The monetary amount associated with the transaction. - **type** (string) - The type of loyalty transaction (e.g., 'EarnPoints'). - **tx** (string) - The transaction hash on the blockchain. - **createdAt** (string) - The timestamp when the transaction occurred. - **code** (number) - The HTTP status code, expected to be 200. ```json { "data": [ { "_id": "tx123", "partner_id": "507f1f77bcf86cd799439012", "partner_name": "Coffee House", "member_id": "507f1f77bcf86cd799439011", "points": 100, "amount": 50, "type": "EarnPoints", "tx": "0xabc123...", "createdAt": "2024-01-20T14:30:00Z" } ], "code": 200 } ``` ``` ```APIDOC ## GET /loyalty/statistics ### Description Retrieves loyalty statistics for the partner. ### Method GET ### Endpoint `/loyalty/statistics` ### Response #### Success Response (200) - **data** (object) - Contains loyalty statistics. - **total_points_earned** (number) - Total points earned by members. - **total_points_redeemed** (number) - Total points redeemed by members. - **active_members** (number) - Number of active loyalty members. - **total_transactions** (number) - Total number of loyalty transactions. - **code** (number) - The HTTP status code, expected to be 200. ```