Skip to content

func-api-users-post

Description

Adds a user's email address to the firefly-users DynamoDB allowed list, granting them permission to sign in with Google. This is the invitation mechanism — no email is sent automatically; the inviting super user must notify the recipient directly.

Invitations expire after 24 hours. If the invited user does not sign in within that window, the invitation is automatically removed by DynamoDB TTL and they must be re-invited.

Super user access is required. The function validates the email format and rejects duplicate invitations.

Invocation

Invoked by API Gateway on an HTTP POST /users request.

API Endpoints

MethodPathAuthDescription
POST/usersSuper userInvite a new user

Request Body

json
{
  "email": "user@example.com"
}
FieldTypeRequiredDescription
emailstringYesGoogle email address; must be a valid email format

DynamoDB Record

The function writes the following item to the firefly-users table:

AttributeDescription
emailThe invited user's email (partition key)
invited_byEmail of the super user who sent the invitation
created_atISO-8601 timestamp of the invitation
expires_atUnix timestamp 24 hours after created_at; used as the DynamoDB TTL attribute to auto-delete the record if the user does not sign in

Response Codes

CodeReason
201 CreatedUser added to allowed list
400 Bad RequestMissing or invalid email
403 ForbiddenCaller is not a super user
409 ConflictEmail already exists in the allowed list

See the API Reference for full schema documentation.

Deployment

See the deployment workflow documentation for workflow steps, infrastructure dependencies, and failure scenarios.