ChainVine API Docs
  • Chainvine
    • Product and Features
    • Technical Overview
  • ⚙️Developers
    • 🔨Use Cases
      • Leverage cookies
      • Link Claimer/Referrer
      • Record Link Click
      • Generate a Referrer Link
      • Record a Transfer Event
      • Complete a Requirement
    • 🖼️Embedded Widget
      • Implementation
      • FAQ
    • 🧰SDK
      • Implementation
      • Configuring the Client
      • Classes and Functions
        • Utility Methods
        • ChainvineClient
          • getReferralUrl(walletAddress)
          • recordClick(referrer)
          • linkReferrer([payload,])
          • referralConversion([payload,])
          • syncUser(walletAddress)
          • getCampaignReferralStats([payload,])
        • ChainvineUser
          • Initializing the client
          • joinCampaign([campaignParams,])
          • getRequirement([payload,])
          • getUserStats([payload,])
          • verifyRequirement([payload,])
          • completeRequirement([payload,])
          • claimEligibleEarnings([payload,])
          • transferEvent([payload,])
          • referral([campaignParams,])
            • linkToReferrer(referrer)
            • url()
          • setRewardTiersOverride([payload,])
        • Errors
        • Authentication
          • Getting your API Key
          • Allow-listing a domain
      • FAQ
    • 🪝Webhooks
    • 📔Open API Specification
  • Rewards
    • Claiming For Users
      • On ChainVine
Powered by GitBook
On this page
  1. Developers

Open API Specification

PreviousWebhooksNextClaiming For Users

Last updated 1 year ago

Context

Here you will find our OpenAPI specification for the Chainvine API.

All endpoints below require you to provide your api key in the headers

{
    'X-API-KEY': 'your-api-key'
}

SyncUser

Always call this method early on in your flows to fetch a user's Chainvine ID.

Note: the SDK handles calling this endpoint for your when using the SDK to call the methods in the ChainvineUser section.

This endpoint can also be used to update the user's information.

ChainvineUser

These endpoints can also be covered via the SDK. Please see methods outlined there as needed or examples of how to use these endpoints to suit your needs.

V1 Endpoints

CodeGeneration

If you would like to generate custom code for the endpoints above, please visit our and select the "Export" drop down at the top right of the page.

⚙️
📔
swaggerhub page

Get the referral url for your user

get

Generates your user's referral url for the program id provided

Authorizations
Path parameters
user_idstringRequired
campaign_idstringRequired

The campaign id you want to generate a referral url for

Responses
200
OK
400
Bad Request
get
GET /api/v2/user/{user_id}/campaign/{campaign_id}/referral/url HTTP/1.1
Host: api.chainvine.xyz
X-API-KEY: YOUR_API_KEY
Accept: */*

No content

Creates or updates a user, and returns the user's details. Use this method to get your user's Chainvine ID to use the methods bellow.

post
Authorizations
Body
chain_idstringOptional
emailstringOptional
external_idstringOptional
firstNamestringOptional
lastNamestringOptional
networkstringOptional
wallet_addressstringOptional
user_typestringRequiredDefault: walletPattern: ^(wallet|email|externalId)
Responses
200
User created successfully
application/json
400
Invalid request body
500
Internal server error
post
POST /api/v2/users HTTP/1.1
Host: api.chainvine.xyz
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 154

{
  "chain_id": "text",
  "email": "text",
  "external_id": "text",
  "firstName": "text",
  "lastName": "text",
  "network": "text",
  "wallet_address": "text",
  "user_type": "wallet"
}
{
  "id": "text"
}

Handle a transfer event

post

Send a custom transfer event with a monetary payload to apply to credit as a reward to the referrer who referrer the user

Authorizations
Path parameters
user_idstringRequired
campaign_idstringRequired

The campaign id you want to generate a transfer event in

Body
amountnumberRequiredExample: 12443.43
requirement_idstringOptionalExample: anId123
external_identifierstringOptionalExample: Ok
feenumberOptionalExample: 134.32
token_addressstringOptionalExample: Ok
transaction_hashstringOptionalExample: Ok
usd_valuenumberOptionalExample: 134.32
user_idstringOptionalExample: Ok
wallet_addressstringOptionalExample: Ok
Responses
200
Event handled successfully
application/json
400
Bad Request
post
POST /api/v2/user/{user_id}/campaign/{campaign_id}/events/transfer HTTP/1.1
Host: api.chainvine.xyz
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 187

{
  "amount": 12443.43,
  "requirement_id": "anId123",
  "external_identifier": "Ok",
  "fee": 134.32,
  "token_address": "Ok",
  "transaction_hash": "Ok",
  "usd_value": 134.32,
  "user_id": "Ok",
  "wallet_address": "Ok"
}
{
  "amount": 12443.43,
  "requirement_id": "anId123",
  "external_identifier": "Ok",
  "fee": 134.32,
  "token_address": "Ok",
  "transaction_hash": "Ok",
  "usd_value": 134.32,
  "user_id": "Ok",
  "wallet_address": "Ok"
}

Mark a requirement as complete

post

Completes a requirement for a user within a referral program/campaign

https://docs.chainvine.xyz/technical/sdk/use-cases/requirements/completing-a-requirement-for-a-user

Authorizations
Path parameters
user_idstringRequired
Body
idstring · slugRequired

The id of the requirement your wish to complete for the user

Example: d0djj9dj9dj0jk
Responses
200
Referral was successfully registered
application/json
400
invalid input, object invalid
401
There is an issue with your authentication, or the campaign you're referring for doesn't belong to your account/is unknown
post
POST /api/v2/user/{user_id}/requirements/complete HTTP/1.1
Host: api.chainvine.xyz
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 52

{
  "campaign": {
    "id": "c5de90fe"
  },
  "id": "d0djj9dj9dj0jk"
}
{
  "message": "Ok"
}
  • Context
  • All endpoints below require you to provide your api key in the headers
  • SyncUser
  • POSTCreates or updates a user, and returns the user's details. Use this method to get your user's Chainvine ID to use the methods bellow.
  • ChainvineUser
  • POSTCreate a referral between a referrer and claimer
  • GETGet the referral url for your user
  • POSTHandle a transfer event
  • POSTMark a requirement as complete
  • V1 Endpoints
  • POSTRecord a link click
  • CodeGeneration

Create a referral between a referrer and claimer

post

Create a referral between a referrer and a claimer

Authorizations
Path parameters
user_idstringRequired
campaign_idstringRequired

The campaign id you want to create a referral in

Body
campaign_idstring · slugRequired

The campaign id you want to create a referral in

Example: joidj2odkd
referrerstring · uuidRequired

The referring user's Chainvine Id, obtained via the referral link r parameter

Example: fjdopwdp2pmosjo2ds
wallet_addressstringRequiredExample: 0x03jkd0ij2od
Responses
200
OK
400
Bad Request
post
POST /api/v2/user/{user_id}/campaign/{campaign_id}/link/referral HTTP/1.1
Host: api.chainvine.xyz
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 93

{
  "campaign_id": "joidj2odkd",
  "referrer": "fjdopwdp2pmosjo2ds",
  "wallet_address": "0x03jkd0ij2od"
}

No content

Record a link click

post

Records a click on a user's referral URL

Authorizations
Path parameters
community_idstringRequired
campaign_idstringRequired

The campaign id to track the link click against

Query parameters
referrerstringRequired

The referrer's referral code (found in the URL)

Body
campaign_idstring · slugRequired

The campaign id you want to create a referral in

Example: joidj2odkd
referrerstring · uuidRequired

The referring user's Chainvine Id, obtained via the referral link r parameter

Example: fjdopwdp2pmosjo2ds
wallet_addressstringRequiredExample: 0x03jkd0ij2od
Responses
200
Link click was tracked
400
invalid input, object invalid
401
There is an issue with your authentication, or the campaign you're referring for doesn't belong to your account/is unknown
post
POST /v1/chainvine/community/{community_id}/campaign/{campaign_id}/record-click HTTP/1.1
Host: api.chainvine.xyz
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 93

{
  "campaign_id": "joidj2odkd",
  "referrer": "fjdopwdp2pmosjo2ds",
  "wallet_address": "0x03jkd0ij2od"
}

No content