Show examples in:
JavascriptHTTP
Endpoint info
Available examples
Dashboard API > Session

Create a new session

Warning: Experimental API

Please note that the Dashboard API is an experimental, prerelease API. This API method is considered unstable, and should be avoided in production environments and automations. Changes may occur at any time without warning.

Returns

Returns a resource object of type session

Examples

import { buildClient } from "@datocms/dashboard-client";
async function run() {
const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
const session = await client.session.rawCreate({
type: "email_credentials",
attributes: { email: "foo@bar.com", password: "changeme" },
});
// Check the 'Returned output' tab for the result ☝️
console.log(session);
}
run();
{
type: "session",
id: "eyJCJhbGci.eyJhaWwuY29tIn0.32wQOMci",
relationships: { account: { data: { type: "account", id: "312" } } },
}