> For the complete documentation index, see [llms.txt](https://docs.defguard.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.defguard.net/for-developers/rest-api/core/ssh-key/get-ssh-authorized-keys-in-the-authorized_keys-file-format.md).

# Get SSH authorized keys in the \`authorized\_keys\` file format

Meant to be used as an `AuthorizedKeysCommand` in `sshd`. Filter the users with the `username` or `group` query parameter.

```json
{"openapi":"3.1.0","info":{"title":"defguard Core API","version":"2.0.3"},"tags":[{"name":"SSH key","description":"SSH and GPG authentication keys of users."}],"paths":{"/api/v1/ssh_authorized_keys":{"get":{"tags":["SSH key"],"summary":"Get SSH authorized keys in the `authorized_keys` file format","description":"Meant to be used as an `AuthorizedKeysCommand` in `sshd`. Filter the users with the\n`username` or `group` query parameter.","operationId":"get_authorized_keys","parameters":[{"name":"username","in":"query","description":"Return the keys of this user.","required":false,"schema":{"type":"string"}},{"name":"group","in":"query","description":"Return the keys of all members of this group.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Authorized keys, one per line.","content":{"text/plain":{"schema":{"type":"string"}}}},"400":{"description":"Neither username nor group was provided.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"500":{"description":"Unable to get authorized keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}}},"components":{"schemas":{"ApiErrorResponse":{"type":"object","description":"Body returned with error responses.","required":["msg"],"properties":{"code":{"type":["string","null"],"description":"Machine-readable error code, returned for selected errors."},"msg":{"type":"string","description":"Human-readable error message."}}}}}}
```
