Endpoint, how collect -Credential?

When I call my endpoint from external source with the invoke-restmethod how can I catch/collect the -Credential parameter inside my endpoint and use it?