Skip to main content

Session object

datetime
required
The date and time the session is no longer valid.
string
required
OAuth token used to authenticate each API request.
object
required
Object containing variables for the pipeline.
If your Mage project requires user authentication, REQUIRE_USER_AUTHENTICATION=1, you'll need to create a new session before you can make any API calls. If your project does not require user auth, you can skip straight to making API calls with your API key. To initialize a session, see the POST /api/sessions endpoint. You'll need to supply your email and password as a JSON payload. Here's an example of how to do this in Python. Before starting, first nano ~/YOUR_SECRETS_PATH/.env.mage, replacing YOUR_SECRETS_PATH with an apporpriate directory, to create a new secrets file. Then add the following to your secrets file:
Then, in a Python script, you can do the following: