This message was deleted.
# helpdesk
s
This message was deleted.
m
Hey @brief-refrigerator-69901 — we haven’t gotten around to this yet. cc @acoustic-engineer-41666 for visibility
👀 1
while I have you here, what are you interested in using this API for?
b
Room related data. • Total Number of participants • Participant data (the more info we have on each the better it'd be) ◦ Main Ones would be ▪︎ Participant Join Time ▪︎ Participant Left Time ▪︎ Duration (Although this can be handled with the previous two metrics) ▪︎ Server Region Connected ▪︎ SDK used (This could be useful for debugging for clients which have different versions of application) ◦ Bonus: ▪︎ Track Subscriptions for each participants ▪︎ Participant's published track info ▪︎ Any Participant Connections details present in the Cloud Dashboard ▪︎ Call Quality for the participant • Room duration • Room bandwidth consumption I can think about this some more, but any information which could become billing metrics for clients of LiveKit. As a a LK Client, then we can charge our own clients based on the data the API would be returning.
👀 1
This said, thanks for the update @magnificent-art-43333.
m
thanks for the detail Pat. Are you planning to charge your customers using a usage-based model?
b
That is the plan. I haven't flushed out the exact details but I'm looking to implement a per participant x room duration calculation model. I think the pay-per-usage vs Tier would be more beneficial for our clients.
👍 1
Hey @magnificent-art-43333, I know you guys have a lot on the go, and a lot of priorities, so I can totally understand. This said, a while back I remember someone else asking about this feature and you would be returning with an ETA, simply curious to know if any thoughts had been put towards this yet or not.
I'm asking simply to know how high or low would this be for you guys and if I should try to plan out an alternative for the time being.
m
No, we haven’t fleshed this out yet. The team has been slammed with other things. I’ve mentioned @acoustic-engineer-41666 so he can take this back and figure out where it fits into our roadmap. My sense is that it’s on the lower-end of priorities at the moment.
b
Thanks a lot for the quick update Russ. Appreciate it.
🙏 1
a
@brief-refrigerator-69901 what if you just had, for each room: • room name • session id • total participants • room duration • bandwidth used would that be useful for you, or do you really need per-participant data for the pricing model you want to implement?
nvm, sorry I didn’t see your other message about the room x participant model
b
@acoustic-engineer-41666 I think that would be a great starting point. The participant data would eventually be needed because the goal was to price based on participants + duration. 100 participants watching 1 participant wouldn't be the same cost as if we had 100 participants sharing their mic and video
a
So we actually do have a kinda hacky “api” that you can use for this. We shipped it with little fanfare, but now the Sessions and Participants tables in the Cloud UI have a
CSV
link that you can use to download a CSV of that table. These links are generated with each call and they only include data for rooms from the last 14 days.
b
Without the UI, could someone pull those through a specific url?
Lets say, someone would have a cron running every x, to download the data and import it on their end
a
so you can download the CSVs in URLs like these: •
<https://cloud.livekit.io/api/projects/><YOUR_PROJECT_ID>/sessions/closed/csv
— details for closed rooms •
<http://cloud.livekit.io/projects/|cloud.livekit.io/projects/><YOUR_PROJECT_ID>/sessions/<ROOM_ID>
— details for the participants in a given session
now the hacky bit is that if you want to grab those automatically you’ll have to spoof your own session token, which you can copy from your browser cookies for your cloud.livekit.io session
… and, hm, now I’m looking at that and the latest version of Chrome actually makes it harder for a user to get at the actual cookie values 😕
b
Ahh gotcha. I see. Yeah, the authorization part might be the hardest to do.
Wonder if on the cloud we could use ssh keys auth
a
or maybe re-use the
livekit-cli
auth
b
For server to server authorization.
a
ah right
b
Is the unofficial api which you were talking about is this accessible for LK clients? Or rather in closed state atm?
a
So the hacky thing you can do for now is, grab your
__Secure-next-auth.browser-session-token
cookie from your browser session and save those as the cookies you use from your http client to fetch those CSVs. I believe that session should be valid for 30 days
Don’t quite understand your last question there
b
Oh sorry I had misread one of your previous message. My bad.
I might just give this "hacky" api a shot and see.
a
Let us know how it goes! Note that if you have very many rooms, the sessions csv might take a while to load, so make sure your http client isn’t timing out
b
Can we pass filters to those links? Per say get only the last 12hrs
This said, I think my approach would be to leverage the livekit-cli on room disconnect to automatically fetch the data, so id be per session and not overall sessions.
Thanks for all your help @acoustic-engineer-41666
a
just checked, the csv doesn’t support filters
grabbing session data on room disconnect sounds like a good approach!
❤️ 1
b
@acoustic-engineer-41666 Just want to report something. It seems like the CSV works, but seems to have an issue with participants tracks returning
[object Object]
🙏 1
And if I may ask for a feature request:
<https://cloud.livekit.io/api/projects/><YOUR_PROJECT_ID>/sessions/<SESSION_ID>/csv
Endpoint which could simply provide the single row of that session_id
👀 1
Also since we're talking about it, the closed sessions CSV, If it could include the
started_at
just like active already includes would pretty neat.
👍 1
Again, Thanks a lot for all your help @acoustic-engineer-41666. Ill keep you posted how this works. Copying the token shouldn't be much of an issue.
a
if you’re using Chrome, this settings flag is useful for grabbing the cookie value
b
Yeah well I can still see them fairly easily through browser inspect.
r
I think the usecase @brief-refrigerator-69901 outlined here is almost the same we have. We have for now resorted to a hacky workaround using
webhooks
, but that has its drawbacks. Being able to get the data as csv or JSON payload returned from an API call would make my life a lot easier in this regard.
👀 1
m
thanks for sharing this @rough-agent-34205 — fwiw, we’re discussing internally how we can provide something more official sooner rather than later.
🙏 2
r
Appreciate you guys looking into it 👍
b
@magnificent-art-43333 Thanks and wonderful news Russ!
c
hi, @acoustic-engineer-41666, can you please explain, "...or maybe re-use the
livekit-cli
auth..."
r
@magnificent-art-43333 Sorry to be pesty, but any news on this? 😇 If we could get a token without manual intervention, the csv solution Noah Tye described above would really go a long way (at least for us).
m
cc @acoustic-engineer-41666
d
Hey Sebastian, we'll need to add this to the docs, but we now have a couple of APIs that would allow you to get JSON responses back. Listing sessions (last 24h)
curl -H"Authorization: Bearer <token>" <https://cloud-api.livekit.io/api/project/><projectID>/sessions
Getting details of a single session
curl -H"Authorization: Bearer <token>" <https://cloud-api.livekit.io/api/project/><projectID>/sessions/<sessionID>
The token required here is just a standard LiveKit Access Token. It should contain the grant
roomList
(read-only view of all rooms). You can use our CLI to create a test token:
Copy code
livekit-cli create-token --list --valid-for 10000h
🙏 2
🔥 3
r
This sounds great, thank you!
b
This is great news guys!! 🔥
🙌 1
r
@dry-elephant-14928 I just had a chance to try it and this is indeed incredibly useful! 2 Things I noticed: 1. In the csv download (https://cloud.livekit.io/projects/<project_id>/sessions/<session_id>/csv), i saw that you also publish information about the published tracks. Any chance this could make it into the API call payload as well? 2. Not directly related to the new API, but in the csv download, there seems to be an error with serializing the
published_tracks
information
b
@rough-agent-34205 we are now returning publishedSources info for each participant in the API payload:
Copy code
"participants": [
        {
            "participantIdentity": "u1",
            ....
            "publishedSources": {
                "cameraTrack": true,
                "microphoneTrack": true
            }
        }
    ]
please let us know if you run into any issues
🙌 3
r
Awesome, thanks for reacting so quickly! I have a few questions regarding the behavior of your reports, if you'd be so kind: • Which field determines if a session is older than 24h? Is it the end time? • Regarding the
/sessions
call, do only sessions that have ended get reported or also those that are currently active? ◦ If active sessions are listed as well, does the
/sessions/<session_id>
call list participants that are currently joined to a room or only those that have disconnected? Perhaps some context for these questions is helpful: We intend to use this information for billing our clients on a monthly basis and we are wondering what happens in case sessions are running for extended periods of time.
b
@rough-agent-34205 1. Any room created in past 24 hours are listed currently. 2. Both active and closed sessions/rooms get reported 3. Active and disconnected participants are listed in all rooms
🙏 1
b
These APIs for getting session data programmatically are great! I wanted to follow up with - Is there any way to get sessions older than 24 hours ago? I'm interested in getting this data so I can track usage, but I'm worried about some error or outage leading to me missing some session data.
d
currently we are only returning the last 24h.. but introducing parameters so you can export specific days would be something we'd like to do as well
👍 1
b
Question on the data returned from these two endpoints. When I hit the first one (listing all sessions) it comes back with a field
sessionId
that looks something like like
RM_1234asdf1B
. When I hit the second one (listing a single session using that
sessionId
, it comes back with a field
roomId
that matches. Should that
roomId
be called
sessionId
instead?
Similarly, are there definitions about what
createdAt
and
lastActive
from the first endpoint and
startTime
and
endTime
from the second endpoint mean?
p
Hey @billions-summer-21168,
roomId
and
sessionId
are indeed the same thing. These were internal apis that we exposed and there are still some awkward naming relics there.
createdAt
and
startedAt
are the same
lastActive
is either now, or when then room was deleted
endedAt
is either null, or when the room was deleted
b
Thanks for getting back to me and clarifying those fields @powerful-garage-56223!
🙌 1