Project Admin

Project Admin Endpoints

Bot EndpointPOST /admin/projects/:projectId/bot​ Creates a new Medplum Bot. Posting to this endpoint creates a Bot resource and a corresponding ProjectMembership resource. Parameters​ { name: string; description?: string; accessPolicy?: Reference<AccessPolicy>; } Example request​ await medplum.post('admin/projects/:projectId/bot', { name: 'Hello World Bot', description: 'Hello world', accessPolicy: { reference: 'AccessPolicy/access-policy-id', }, }); medplum post admin/projects/:projectId/bot \ '{ "name": "Hello World Bot", "description": "Hello world", "accessPolicy": { "reference": "AccessPolicy/access-policy-id" } }' curl https://api.medplum.com/admin/projects/:projectId/bot \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Hello World Bot", "description": "Hello world", "accessPolicy": { "reference": "AccessPolicy/:access-policy-id" }' Example Response​ { resourceType: 'Bot', name: 'Hello World Bot', description: 'Hello world', runtimeVersion: 'awslambda', sourceCode: { contentType: 'text/typescript', title: 'index.ts', url: 'Binary/:uuid' }, id: ':bot-uuid', meta: { project: ':projectId', //... }, } Client Application EndpointPOST /admin/projects/:projectId/client​ Creates a new ClientApplication. Posting to this endpoint creates a ClientApplication resource and a corresponding ProjectMembership resource. Parameters​ { name: string; description?: string; redirectUri?: string; accessPolicy?: Reference<AccessPolicy>; identityProvider?: { authorizeUrl?: string; tokenUrl?: string; userInfoUrl?: string; clientId?: string; clientSecret?: string; useSubject?: boolean; } } Example request​ await medplum.post('admin/projects/:projectId/client', { name: 'Hello World Client', description: 'Client App for Medplum Hello World', redirectUri: 'https://example.com/redirect', accessPolicy: { reference: 'AccessPolicy/access-policy-id', }, }); medplum post admin/projects/:projectId/client \ '{ "name": "Hello World Client", "description": "Client App for Medplum Hello World", "redirectUri": "https://example.com/redirect" "accessPolicy": { "reference": "AccessPolicy/access-policy-id" } }' curl https://api.medplum.com/admin/projects/:projectId/client \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Hello World Client", "description": "Hello world", "redirectUri": "https://example.com/redirect" "accessPolicy": { "reference": "AccessPolicy/:access-policy-id" }' Example Response​ { meta: { project: ':projectId', //... }, resourceType: 'ClientApplication', name: 'Hello World Client', id: ':clientId', secret: ':clientSecret', description: 'Client App for Medplum Hello World', redirectUri: 'https://example.com/redirect' } Invite User EndpointPOST /admin/projects/:projectId/invite​ Invite a new user to the project. This will perform the following actions: Search for an existing user with the provided email, if given Search for an existing profile resource (Patient, Practitioner, or RelatedPerson) Create a new User, if no existing User was found, Set the password if password is given Generate a password reset url Create a new profile resource, if no existing profile was found Create a corresponding ProjectMembership resource, for the (user, profile) pair Send an invite email, if sendEmail is true Parameters​ { resourceType: 'Patient' | 'Practitioner' | 'RelatedPerson'; firstName: string; lastName: string; email?: string; externalId?: string; scope?: 'project' | 'server'; password?: string; sendEmail?: boolean; membership?: Partial<ProjectMembership>; upsert?: boolean; forceNewMembership?: boolean; mfaRequired?: boolean; } parameter description resourceType The User's profile resourceType firstName, lastName The first and last names that will be assigned to user's profile resource. Ignored if a profile resource already exists email The email address assigned to the User. Used to identify users within each project externalId The unique id provided by external identity provider (if applicable). See Using External Ids password The User's password scope The scope of the user. If project, the user will be scoped to the project. If server, the user will be a server scoped user. Defaults to server for Practitioners and project for Patients. See server vs project scoped user guide sendEmail If true, send an invite email to the user. If self-hosting, see our guide on setting up SES membership Used to override any fields of the resulting ProjectMembership resource. Common use cases include: Setting Access Policies upon invite Overriding the default ProjectMembership.profile upsert If true, allows updating existing users and profiles instead of creating new ones. When enabled, the invite will search for existing users and profiles and update them if found, rather than throwing an error message. forceNewMembership If true, forces creation of a new ProjectMembership resource even if one already exists for the user/profile combination in the project. mfaRequired If true, requires the user to set up Multi-Factor Authentication (MFA) during their first login. See MFA documentation for more details. Constraints​ Either email or externalId is required. Examples​ Inviting a Practitioner​ await medplum.post('admin/projects/:projectId/invite', { resourceType: 'Practitioner', firstName: 'George', lastName: 'Washington', email: 'dr.gw@example.gov', password: 'lib3rty0rDe4th!', }); medplum post admin/projects/:projectId/invite \ '{ "resourceType": "Practitioner", "firstName": "George", "lastName": "Washington", "email": "dr.gw@example.gov", "membership": { "admin": true } }' curl https://api.medplum.com/admin/projects/:projectId/invite \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "resourceType": "Practitioner", "firstName": "George", "lastName": "Washington", "email": "dr.gw@example.gov", "membership": { "admin": true } }' Example Response: