Aller au contenu
Ressource · Files and account

Users

The user is the person the API token acts for.

users:readusers:write
MéthodeCheminRésumé
GET…/meGet the authenticated user profile
PATCH…/meUpdate the authenticated user profile
GET…/me/permissionsGet the permissions granted to the authenticated user

Les chemins commencent par /users. Les endpoints GET demandent users:read, les autres users:write.

L’objet User

firestoreIdstringobligatoire

ID of the user.

firstNamestring
lastNamestring
displayNamestring
emailstringemailobligatoire
statusstringobligatoire

Status of the user account.

  • registered

    The user has signed up.

phonestring
Afficher les 15 champs
birthdatestring
positionstring

Position of the user in the company.

  • ceo

    Chief executive officer.

  • cfo

    Chief financial officer.

  • otherCLevel

    Another C-level executive.

  • businessAdministrative

    Business or administrative staff.

  • accountant

    Accountant.

  • other

    Another position.

photoUrlstringuri
localestring
creationobjectobligatoire

When and by whom the resource was created.

Afficher les 2 champs enfants
creationDateTimestringdate-timeobligatoire

Date and time when the resource was created.

createdBystring

ID of the user who created the resource, when recorded.

activationobjectobligatoire

Whether the resource is enabled, and when and by whom it was last enabled or disabled.

Afficher les 3 champs enfants
enabledbooleanobligatoire

Whether the resource is enabled.

updateDateTimestringdate-timeobligatoire

Date and time when enabled was last set.

updatedBystring

ID of the user who last set enabled, when recorded.

notificationsobject
Afficher les 2 champs enfants
defaultsRecord<string, object>
Afficher les 2 champs enfants
emailbooleanobligatoire
pushbooleanobligatoire
workspacesRecord<string, object>
Afficher les 2 champs enfants
modestringobligatoire

How the user receives the notifications of the workspace.

  • default

    The workspace follows the default notification settings of the user.

  • custom

    The workspace follows its own notification settings, in custom.

  • muted

    The user receives no notification for the workspace.

customRecord<string, object>
Afficher les 2 champs enfants
emailbooleanobligatoire
pushbooleanobligatoire
relationshipsobjectobligatoire
Afficher 1 champ enfant
lastAcceptedAgreementsRecord<string, object>obligatoire
Afficher les 5 champs enfants
firestoreIdstringobligatoire

ID of the agreement.

userIdstringobligatoire

ID of the user.

acceptanceDateTimestringdate-timeobligatoire
revisionnumberobligatoire
typestringobligatoire

Legal document of Sway that the user accepts.

  • termsAndConditions

    Terms and conditions of Sway.

  • privacyPolicy

    Privacy policy of Sway.

  • cookiePolicy

    Cookie policy of Sway.

L’objet User
{
  "firestoreId": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj",
  "firstName": "string",
  "lastName": "string",
  "displayName": "string",
  "email": "anna.meier@example.com",
  "status": "registered",
  "phone": "+41791234567",
  "birthdate": "1990-05-14",
  "position": "ceo",
  "photoUrl": "https://example.com",
  "locale": "string",
  "creation": {
    "creationDateTime": "2026-03-02T09:15:00.000Z",
    "createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
  },
  "activation": {
    "enabled": true,
    "updateDateTime": "2026-03-02T09:15:00.000Z",
    "updatedBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
  },
  "notifications": {
    "defaults": {
      "key": {
        "email": true,
        "push": true
      }
    },
    "workspaces": {
      "Wk7fQ2xR9bLm4tZp8sNv": {
        "mode": "default",
        "custom": {
          "key": {
            "email": true,
            "push": true
          }
        }
      }
    }
  },
  "relationships": {
    "lastAcceptedAgreements": {
      "key": {
        "firestoreId": "Ag4kR8tN2wQx6zLp3vMb",
        "userId": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj",
        "acceptanceDateTime": "2026-03-02T09:30:00.000Z",
        "revision": 0,
        "type": "termsAndConditions"
      }
    }
  }
}
GET/users/me

Get the authenticated user profile

Portéeusers:read

Paramètres de requête

fieldsstring

Comma-separated property paths to include in the response, or in each item of a list. Use dots for nested paths.

Renvoie

200

Successful response

dataUserobligatoire
curl 'https://api.business.swayapp.io/v1/users/me' \
  -H "Authorization: Bearer $SWAY_API_KEY"
{
  "data": {
    "firestoreId": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj",
    "firstName": "string",
    "lastName": "string",
    "displayName": "string",
    "email": "anna.meier@example.com",
    "status": "registered",
    "phone": "+41791234567",
    "birthdate": "1990-05-14",
    "position": "ceo",
    "photoUrl": "https://example.com",
    "locale": "string",
    "creation": {
      "creationDateTime": "2026-03-02T09:15:00.000Z",
      "createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
    },
    "activation": {
      "enabled": true,
      "updateDateTime": "2026-03-02T09:15:00.000Z",
      "updatedBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
    },
    "notifications": {…},
    "relationships": {…}
  }
}
PATCH/users/me

Update the authenticated user profile

Portéeusers:write

Paramètres de requête

fieldsstring

Comma-separated property paths to include in the response, or in each item of a list. Use dots for nested paths.

Corps de la requête

firstNamestring
lastNamestring
positionstring

Position of the user in the company.

  • ceo

    Chief executive officer.

  • cfo

    Chief financial officer.

  • otherCLevel

    Another C-level executive.

  • businessAdministrative

    Business or administrative staff.

  • accountant

    Accountant.

  • other

    Another position.

birthdatestring
phonestring
localestring

Renvoie

200

Successful response

dataUserobligatoire
curl -X PATCH 'https://api.business.swayapp.io/v1/users/me' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "position": "ceo",
  "birthdate": "1990-05-14",
  "phone": "+41791234567"
}'
{
  "data": {
    "firestoreId": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj",
    "firstName": "string",
    "lastName": "string",
    "displayName": "string",
    "email": "anna.meier@example.com",
    "status": "registered",
    "phone": "+41791234567",
    "birthdate": "1990-05-14",
    "position": "ceo",
    "photoUrl": "https://example.com",
    "locale": "string",
    "creation": {
      "creationDateTime": "2026-03-02T09:15:00.000Z",
      "createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
    },
    "activation": {
      "enabled": true,
      "updateDateTime": "2026-03-02T09:15:00.000Z",
      "updatedBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
    },
    "notifications": {…},
    "relationships": {…}
  }
}
GET/users/me/permissions

Get the permissions granted to the authenticated user

Portéeusers:read

Paramètres de requête

fieldsstring

Comma-separated property paths to include in the response, or in each item of a list. Use dots for nested paths.

Renvoie

200

Successful response

dataUserPermissionsobligatoire
Afficher les 3 champs enfants
vintegerobligatoire
wsRecord<string, string[]>obligatoire
  • ws.owner

    Owner of the workspace, with every permission, including deleting the workspace and managing owners.

  • ws.admin

    Administrator of the workspace, with every permission except managing owners and deleting the workspace or its files.

  • ws.member

    Member of the workspace, who works on its transactions, invoices, payments and accounting but manages neither its bank accounts nor its members.

  • ws.viewer

    Viewer of the workspace, a role that grants no permission.

  • ws.support

    Sway support access, granted when you invite the Sway bot.

  • ba.owner

    Owner of the billing account, with every permission, including deleting it.

  • ba.admin

    Administrator of the billing account, who reads and updates it but cannot delete it.

  • ba.member

    Member of the billing account, who can only read it.

baRecord<string, string[]>obligatoire
  • ws.owner

    Owner of the workspace, with every permission, including deleting the workspace and managing owners.

  • ws.admin

    Administrator of the workspace, with every permission except managing owners and deleting the workspace or its files.

  • ws.member

    Member of the workspace, who works on its transactions, invoices, payments and accounting but manages neither its bank accounts nor its members.

  • ws.viewer

    Viewer of the workspace, a role that grants no permission.

  • ws.support

    Sway support access, granted when you invite the Sway bot.

  • ba.owner

    Owner of the billing account, with every permission, including deleting it.

  • ba.admin

    Administrator of the billing account, who reads and updates it but cannot delete it.

  • ba.member

    Member of the billing account, who can only read it.

curl 'https://api.business.swayapp.io/v1/users/me/permissions' \
  -H "Authorization: Bearer $SWAY_API_KEY"
{
  "data": {
    "v": 0,
    "ws": {
      "key": [
        "ws.owner"
      ]
    },
    "ba": {
      "key": [
        "ws.owner"
      ]
    }
  }
}

Construisez sur vos propres données.

Créez un compte, ouvrez Profil › Développeur et créez une clé limitée aux ressources dont vous avez besoin. Une question sur une intégration ? L’équipe y répond lors d’un appel.