User session
Some actions require a valid user session. For example, Transfer Agent requires a valid user session when sending a package to an email recipient or creating download automations.
Other actions, like uploading to a Portal, do not require a user session.
When you try to perform an action that requires a session, the service responds with a 401 Unauthorized
status code and the following error body:
{
"code": 262146,
"message": "session is nil"
}
Start a session
When you start Transfer Agent, you can also create a new session with an API key. You can provide the API key in a few ways:
- Docker: Define an environment variable or Docker secret
- Configuration file: Specify the key's value in
auth.api_key
- Command line: Use the
-api-key
command-line option
Get current user session
To see which user currently has a valid session with Transfer Agent, use the following request:
curl -X GET http://localhost:8080/api/v1/login
The response will include information like the following:
{
"user": {
"email": "[email protected]",
"id": "01CWEEY5PT3535ETT4TH9NYZVP",
"name": "Firstname Lastname"
},
"teams": [
{
"custom_expiry_default": 30,
"custom_expiry_enabled": true,
"download_limit_default": 12,
"download_limit_enabled": true,
"id": "01CWEEY60MREFF7PPYZ82QSQ9J",
"max_email_recipients": 30,
"name": "Acme",
"subdomain": "acme"
},
...
]
}
Where:
user
object contains logged-in user attributesteams
is an array of all teams that the user belongs to, with details like limits and general settings as configured for that team
You can also retrieve the teams that the user belongs to:
curl -X GET http://localhost:8080/api/v1/teams
If there is no user session, or authentication failed, MASV Transfer Agent responds with a 401 status and information about the error in the response body:
$ curl --head -X GET http://localhost:8080/api/v1/login
HTTP/1.1 401 Unauthorized
Content-Type: application/json
...
Sign in
Note
Deprecated. Use an API key to start a session instead. You can sign up for a new MASV account in the MASV Web App.
To sign in with an existing MASV account:
curl -X POST -H "Content-Type: application/json" http://localhost:8080/api/v1/login -d '{"email":"[email protected]","password":"top_secret_password"}'