# Price Subscribe

{% hint style="warning" %}
The "Test it" functionality requires providing an API key in the Authorization Header. You can acquire a free API key by "purchasing" the free tier of the SVS API at <https://cloud.solanavibestation.com>
{% endhint %}

## Subscribe to Price Updates

> Subscribe to real-time price updates for specified token mints.  Returns streaming price data including average prices over different time periods and the latest trading price.\
> \
> The endpoint accepts an array of mint addresses and returns real-time pricing information including:\
> \
> \* 1-minute average price\
> \* 15-minute average price\
> \* 1-hour average price\
> \* 24-hour average price\
> \* Latest trade price\
> \
> Price updates are streamed as Server-Sent Events (SSE) starting with a  "connected" event, followed by real-time data events with sequence numbers for proper ordering. Each update contains delete and insert operations for efficient price data management. Multiple mints can be tracked simultaneously in a single stream.<br>

````json
{"openapi":"3.1.0","info":{"title":"Solana Vibe Station Price Subscription API","version":"1.0.0"},"servers":[{"url":"https://free.api.solanavibestation.com"}],"security":[{},{"AuthHeader":[]},{"URLParameter":[]}],"components":{"securitySchemes":{"AuthHeader":{"type":"apiKey","in":"header","name":"Authorization","description":"Authorization header for API key authentication.\n\n**Example:**\n```\nAuthorization: your-api-key-here\n```\n"},"URLParameter":{"type":"apiKey","in":"query","name":"api_key","description":"API key passed as a URL parameter for authentication.\n\n**Example:**\n```\nhttps://free.api.solanavibestation.com/subscribe-price?api_key=your-api-key-here\n```\n"}},"schemas":{"SubscribePriceRequest":{"type":"object","description":"Request to subscribe to price updates for specified mints","required":["mints"],"properties":{"mints":{"type":"array","description":"Array of token mint addresses to subscribe to","items":{"type":"string","pattern":"^[1-9A-HJ-NP-Za-km-z]{32,44}$","description":"Token mint address (base58 encoded)"}}}},"SubscribePriceResponse":{"type":"object","description":"Response containing price subscription data and sequence information","required":["json_data","sequence_number"],"properties":{"json_data":{"type":"array","description":"Array of price update operations","items":{"$ref":"#/components/schemas/PriceUpdateOperation"}},"sequence_number":{"type":"integer","format":"int64","minimum":0,"description":"Sequence number for this price update"}}},"PriceUpdateOperation":{"type":"object","description":"Single price update operation containing delete and/or insert operations","properties":{"delete":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/PriceData"}],"description":"Price data to be deleted (null if no deletion)"},"insert":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/PriceData"}],"description":"Price data to be inserted (null if no insertion)"}}},"PriceData":{"type":"object","description":"Price information for a token pair","required":["avg_price_15min","avg_price_1h","avg_price_1min","avg_price_24h","base_mint","latest_price","quote_mint"],"properties":{"avg_price_15min":{"type":"number","format":"double","description":"Average price over the last 15 minutes"},"avg_price_1h":{"type":"number","format":"double","description":"Average price over the last hour"},"avg_price_1min":{"type":"number","format":"double","description":"Average price over the last minute"},"avg_price_24h":{"type":"number","format":"double","description":"Average price over the last 24 hours"},"base_mint":{"type":"string","pattern":"^[1-9A-HJ-NP-Za-km-z]{32,44}$","description":"Base token mint address"},"latest_price":{"type":"number","format":"double","description":"Most recent trade price"},"quote_mint":{"type":"string","pattern":"^[1-9A-HJ-NP-Za-km-z]{32,44}$","description":"Quote token mint address (typically SOL)"}}}}},"paths":{"/subscribe-price":{"post":{"operationId":"subscribe_price","summary":"Subscribe to Price Updates","description":"Subscribe to real-time price updates for specified token mints.  Returns streaming price data including average prices over different time periods and the latest trading price.\n\nThe endpoint accepts an array of mint addresses and returns real-time pricing information including:\n\n* 1-minute average price\n* 15-minute average price\n* 1-hour average price\n* 24-hour average price\n* Latest trade price\n\nPrice updates are streamed as Server-Sent Events (SSE) starting with a  \"connected\" event, followed by real-time data events with sequence numbers for proper ordering. Each update contains delete and insert operations for efficient price data management. Multiple mints can be tracked simultaneously in a single stream.\n","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscribePriceRequest"}}},"required":true},"responses":{"200":{"description":"Success - Streaming price updates","content":{"text/event-stream":{"schema":{"type":"string","description":"Server-Sent Events stream of price updates"}},"application/json":{"schema":{"$ref":"#/components/schemas/SubscribePriceResponse"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"type":"object","properties":{"mints":{"type":"array","items":{"type":"string"}}}}}}},"401":{"description":"Unauthorized","content":{"text/plain":{"schema":{"type":"string"}}}},"403":{"description":"Forbidden","content":{"text/plain":{"schema":{"type":"string"}}}},"429":{"description":"Too Many Requests","content":{"text/plain":{"schema":{"type":"string"}}}},"500":{"description":"Internal Server Error","content":{"text/plain":{"schema":{"type":"string"}}}}}}}}}
````
