Session

End Your Session

get
/api/sessions/logout

Destroy the current session, effectively logging out. curl -H "X-Session-ID: 0123456789" "https://lor.instructure.com/api/sessions/logout"

Authorizations
x-session-idstringRequired

Session authentication. The session ID can be provided in any of the following ways: [Cookie: 'session'] [Header: 'x-session-id'] [Query parameter: 'session-id'] [Query parameter: first value of 'state'] [Body property: 'sessionId']

Responses
get
/api/sessions/logout

No content

Get Contents of Your Session

get
/api/sessions/{id}

Get the contents of the specified session. Session contents will only be returned for the current session. Sessions are always created for a specific user. Thus user specific information in the session will always belong to the user who created the session.

Example: curl -H "X-Session-ID: 0123456789" "https://lor.instructure.com/api/sessions/0123456789"

Authorizations
x-session-idstringRequired

Session authentication. The session ID can be provided in any of the following ways: [Cookie: 'session'] [Header: 'x-session-id'] [Query parameter: 'session-id'] [Query parameter: first value of 'state'] [Body property: 'sessionId']

Path parameters
idstringRequired

The id of the session

Responses
chevron-right
200

Session information returned successfully

application/json
sidstringOptional

The unique id for the session

expiresstringOptional

The session expiration timestamp (as string)

userIdstringOptional

The id given by Commons for the user

prefersHighContrastbooleanOptional

Whether the user prefers high contrast

localestringOptional

The locale code for the user

userFullNamestringOptional

The full name of the user

accountNamestringOptional

The Commons account name for the user

accountIdstringOptional

The Commons account id for the user

canvasUserIdstringOptional

The Canvas user id

canvasApiDomainstringOptional

The domain for the Canvas account the session was created to work with

rolesstring[]Optional

The Canvas roles the user possesses

isAdminbooleanOptional

Whether the user is an admin of the Canvas account

canSharePublicbooleanOptional

Whether the account can share resources to Public scope

canShowPublicbooleanOptional

Whether the account can view resources in the Public scope

showCuratedResourcesFirstbooleanOptional

Whether the account shows curated content first for search results

showFederalStandardsbooleanOptional

Whether the account uses the federal outcome tagging

showStateStandardsbooleanOptional

Whether the account uses the state outcome tagging

stateStandardstringOptional

State postal code for outcome features

isAccountCuratorbooleanOptional

Whether the user is a content curator for the account

userAvatarUrlstringOptional

A url where an avatar for the user can be retrieved

get
/api/sessions/{id}

Create a Session

post
/api/sessions

Create a session in Commons. In order to generate a Commons session using this API, you must have already launched into Commons through Canvas at least once before. If not, you will get an error informing you that you have never launched into Commons before. Additionally, you will need to have accepted the terms of service. This endpoint also requires that you first acquire a JWT (JSON Web Token) that contains certain information needed by Commons to set up the session. You can acquire this JWT by sending a HTTP GET request to: https://[your-canvas-domain]/api/lti/accounts/self/jwt_token?tool_launch_url=https://lor.instructure.com/api/lti

This endpoint requires the typical Canvas Authorization header. This means you will need to generate an Access Token as described here.

Example: curl -X POST -H "Content-Type: application/json" --data '{"jwt_token": "<contents of JWT token>"}' "https://lor.instructure.com/api/sessions"

Body
jwt_tokenstringRequired

The JWT that is given to you by Canvas. It should be exactly as Canvas gives it to you. Do not decode it and give us the decoded version. We will handle that for you.

Responses
post
/api/sessions

Last updated

Was this helpful?